2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdcrests.item.rest.mapping;
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertSame;
22 import java.util.Collections;
24 import org.junit.Test;
25 import org.openecomp.sdc.versioning.types.Item;
26 import org.openecomp.sdc.versioning.types.ItemStatus;
27 import org.openecomp.sdcrests.item.types.ItemDto;
30 * This class was generated.
32 public class MapItemToDtoTest {
35 public void testConversion() {
37 final Item source = new Item();
39 final String id = "8c3cf5c1-956d-4701-9805-41ee7496a4b0";
42 final String type = "0df6dc63-30a9-453c-9d20-ccd839b30e55";
45 final String name = "fa425317-c53a-4ad2-94f5-9a33f2b76e67";
48 final String owner = "db08f579-7f4c-4d1a-ae92-a1c1c27c8cc6";
49 source.setOwner(owner);
51 final ItemStatus status = ItemStatus.ARCHIVED;
52 source.setStatus(status);
54 final String description = "9b5e29e9-b47a-4ece-b8a0-b68f4b346e3b";
55 source.setDescription(description);
57 final Map<String, Object> properties = Collections.emptyMap();
58 source.setProperties(properties);
60 final ItemDto target = new ItemDto();
61 final MapItemToDto mapper = new MapItemToDto();
62 mapper.doMapping(source, target);
64 assertEquals(id, target.getId());
65 assertEquals(type, target.getType());
66 assertEquals(name, target.getName());
67 assertEquals(description, target.getDescription());
68 assertEquals(owner, target.getOwner());
69 assertEquals(status.name(), target.getStatus());
70 assertSame(properties, target.getProperties());