Unit-tests for mappers in item services
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / item-rest / item-rest-services / src / test / java / org / openecomp / sdcrests / item / rest / mapping / MapActivityLogEntityToDtoTest.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.openecomp.sdcrests.item.rest.mapping;
18
19 import static org.junit.Assert.assertEquals;
20
21 import java.util.Date;
22 import org.junit.Test;
23 import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
24 import org.openecomp.sdc.activitylog.dao.type.ActivityType;
25 import org.openecomp.sdcrests.item.types.ActivityLogDto;
26
27 /**
28  * This class was generated.
29  */
30 public class MapActivityLogEntityToDtoTest {
31
32     @Test()
33     public void testConversion() {
34
35         final ActivityLogEntity source = new ActivityLogEntity();
36
37         final String id = "e8ad437b-8d86-4819-954f-57fb9161a912";
38         source.setId(id);
39
40         final ActivityType type = ActivityType.Upload_Artifact;
41         source.setType(type);
42
43         final String user = "278dbb70-469d-4a5f-bea2-bc62fa9d4671";
44         source.setUser(user);
45
46         final Date timestamp = new Date();
47         source.setTimestamp(timestamp);
48
49         final String comment = "1cf631a9-016b-4914-9ced-ded9d5ba9469";
50         source.setComment(comment);
51
52         final boolean success = true;
53         source.setSuccess(true);
54
55         final String message = "9b5e29e9-b47a-4ece-b8a0-b68f4b346e3b";
56         source.setMessage(message);
57
58         final ActivityLogDto target = new ActivityLogDto();
59         final MapActivityLogEntityToDto mapper = new MapActivityLogEntityToDto();
60         mapper.doMapping(source, target);
61
62         assertEquals(id, target.getId());
63         assertEquals(timestamp, target.getTimestamp());
64         assertEquals(type.name(), target.getType());
65         assertEquals(comment, target.getComment());
66         assertEquals(user, target.getUser());
67         assertEquals(success, target.getStatus().isSuccess());
68         assertEquals(message, target.getStatus().getMessage());
69     }
70 }