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;
23 import java.util.Date;
25 import org.junit.Test;
26 import org.openecomp.sdc.versioning.dao.types.Version;
27 import org.openecomp.sdc.versioning.dao.types.VersionState;
28 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
29 import org.openecomp.sdcrests.item.types.VersionDto;
32 * This class was generated.
34 public class MapVersionToDtoTest {
37 public void testConversion() {
39 final Version source = new Version();
41 final String id = "2cb11529-5b9c-4561-a6d6-9188d3df84d6";
44 final String name = "c9798995-750d-4759-99ac-7942b24e356a";
47 final String description = "269d595d-e818-41d0-a991-bf6dccab8125";
48 source.setDescription(description);
50 final String baseId = "d8efa2d7-8def-4646-8b9d-363ae102cde0";
51 source.setBaseId(baseId);
53 final Date creationTime = new Date();
54 source.setCreationTime(creationTime);
56 final Date modificationTime = new Date();
57 source.setModificationTime(modificationTime);
59 final VersionStatus status = VersionStatus.Deleted;
60 source.setStatus(status);
62 final VersionState state = new VersionState();
63 source.setState(state);
65 final Map<String, Object> additionalInfo = Collections.emptyMap();
66 source.setAdditionalInfo(additionalInfo);
68 final VersionDto target = new VersionDto();
69 final MapVersionToDto mapper = new MapVersionToDto();
70 mapper.doMapping(source, target);
72 assertEquals(id, target.getId());
73 assertEquals(name, target.getName());
74 assertEquals(description, target.getDescription());
75 assertEquals(baseId, target.getBaseId());
76 assertSame(status, target.getStatus());
77 assertSame(state, target.getState());
78 assertEquals(creationTime, target.getCreationTime());
79 assertEquals(modificationTime, target.getModificationTime());
80 assertSame(additionalInfo, target.getAdditionalInfo());