Remove testNG dependencies (part 2)
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-license-rest / vendor-license-rest-services / src / test / java / org / openecomp / sdcrests / vendorlicense / rest / mapping / MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest.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.vendorlicense.rest.mapping;
18
19
20 import static org.junit.jupiter.api.Assertions.assertEquals;
21
22 import java.util.Arrays;
23 import java.util.Collections;
24 import java.util.HashSet;
25 import java.util.Set;
26 import org.junit.jupiter.api.Test;
27 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
28 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
29 import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
30 import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
31 import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolEntityDto;
32
33
34 class MapEntitlementPoolEntityToEntitlementPoolEntityDtoTest {
35
36     @Test
37     void testReferencingFeatureGroups() {
38         EntitlementPoolEntity source = new EntitlementPoolEntity();
39         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
40         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
41                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
42         Set<String> param = new HashSet<>(Collections.singletonList("a3ad0c7a-9f4c-44d2-8c0c-b4b47cd6d264"));
43         source.setReferencingFeatureGroups(param);
44         mapper.doMapping(source, target);
45         assertEquals(target.getReferencingFeatureGroups(), param);
46     }
47
48     @Test
49     void testDescription() {
50         EntitlementPoolEntity source = new EntitlementPoolEntity();
51         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
52         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
53                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
54         String param = "58191782-5de2-4d42-b8ca-119707d38150";
55         source.setDescription(param);
56         mapper.doMapping(source, target);
57         assertEquals(target.getDescription(), param);
58     }
59
60     @Test
61     void testIncrements() {
62         EntitlementPoolEntity source = new EntitlementPoolEntity();
63         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
64         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
65                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
66         String param = "ea6b2eab-f959-41c2-9a09-2898eb5401be";
67         source.setIncrements(param);
68         mapper.doMapping(source, target);
69         assertEquals(target.getIncrements(), param);
70     }
71
72     @Test
73     void testExpiryDate() {
74         EntitlementPoolEntity source = new EntitlementPoolEntity();
75         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
76         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
77                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
78         String param = "7e27d6a4-78be-44df-b099-dd41317586ba";
79         source.setExpiryDate(param);
80         mapper.doMapping(source, target);
81         assertEquals(target.getExpiryDate(), param);
82     }
83
84     @Test
85     void testId() {
86         EntitlementPoolEntity source = new EntitlementPoolEntity();
87         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
88         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
89                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
90         String param = "e2163b3f-971e-4523-a5bc-0e6f7dd44e37";
91         source.setId(param);
92         mapper.doMapping(source, target);
93         assertEquals(target.getId(), param);
94     }
95
96     @Test
97     void testThresholdValue() {
98         EntitlementPoolEntity source = new EntitlementPoolEntity();
99         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
100         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
101                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
102         Integer param = 2146099790;
103         source.setThresholdValue(param);
104         mapper.doMapping(source, target);
105         assertEquals(target.getThresholdValue(), param);
106     }
107
108     @Test
109     void testName() {
110         EntitlementPoolEntity source = new EntitlementPoolEntity();
111         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
112         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
113                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
114         mapper.doMapping(source, target);
115         assertEquals(target.getName(), source.getName());
116         String param = "f8faa28a-435d-4cea-98ee-de7a46b52ec5";
117         source.setName(param);
118         mapper.doMapping(source, target);
119         assertEquals(target.getName(), param);
120     }
121
122     @Test
123     void testOperationalScope() {
124         EntitlementPoolEntity source = new EntitlementPoolEntity();
125         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
126         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
127                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
128         MultiChoiceOrOther<OperationalScope> param = new MultiChoiceOrOther<>();
129         param.setChoices(new HashSet(Arrays.asList("a", "b")));
130         source.setOperationalScope(param);
131         mapper.doMapping(source, target);
132         assertEquals(target.getOperationalScope().getChoices(), param.getChoices());
133     }
134
135     @Test
136     void testStartDate() {
137         EntitlementPoolEntity source = new EntitlementPoolEntity();
138         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
139         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
140                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
141         String param = "afeadea1-9fb7-4d2d-bcc3-3ef298ed1802";
142         source.setStartDate(param);
143         mapper.doMapping(source, target);
144         assertEquals(target.getStartDate(), param);
145     }
146
147     @Test
148     void testManufacturerReferenceNumber() {
149         EntitlementPoolEntity source = new EntitlementPoolEntity();
150         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
151         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper = new
152             MapEntitlementPoolEntityToEntitlementPoolEntityDto();
153
154         String param = "02402e1e-7092-485a-9574-46e2d49cca97";
155         source.setManufacturerReferenceNumber(param);
156         mapper.doMapping(source, target);
157         assertEquals(target.getManufacturerReferenceNumber(), param);
158     }
159
160     @Test
161     void testType() {
162         EntitlementPoolEntity source = new EntitlementPoolEntity();
163         EntitlementPoolEntityDto target = new EntitlementPoolEntityDto();
164         MapEntitlementPoolEntityToEntitlementPoolEntityDto mapper =
165                 new MapEntitlementPoolEntityToEntitlementPoolEntityDto();
166         EntitlementPoolType entitlementPoolType = EntitlementPoolType.One_Time;
167         source.setType(entitlementPoolType);
168         mapper.doMapping(source, target);
169         assertEquals(target.getType(), entitlementPoolType);
170     }
171 }