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;
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;
28 * This class was generated.
30 public class MapActivityLogEntityToDtoTest {
33 public void testConversion() {
35 final ActivityLogEntity source = new ActivityLogEntity();
37 final String id = "e8ad437b-8d86-4819-954f-57fb9161a912";
40 final ActivityType type = ActivityType.Upload_Artifact;
43 final String user = "278dbb70-469d-4a5f-bea2-bc62fa9d4671";
46 final Date timestamp = new Date();
47 source.setTimestamp(timestamp);
49 final String comment = "1cf631a9-016b-4914-9ced-ded9d5ba9469";
50 source.setComment(comment);
52 final boolean success = true;
53 source.setSuccess(true);
55 final String message = "9b5e29e9-b47a-4ece-b8a0-b68f4b346e3b";
56 source.setMessage(message);
58 final ActivityLogDto target = new ActivityLogDto();
59 final MapActivityLogEntityToDto mapper = new MapActivityLogEntityToDto();
60 mapper.doMapping(source, target);
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());