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 / MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest.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.Collections;
23 import java.util.HashSet;
24 import org.junit.jupiter.api.Test;
25 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
26 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
27 import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
28 import org.openecomp.sdcrests.vendorlicense.types.EntitlementPoolRequestDto;
29 import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto;
30
31
32 class MapEntitlementPoolRequestDtoToEntitlementPoolEntityTest {
33
34     @Test
35     void testExpiryDate() {
36         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
37         EntitlementPoolEntity target = new EntitlementPoolEntity();
38         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
39                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
40         String param = "2d9bd40d-9b86-4621-a0b3-015cc65ed29f";
41         source.setExpiryDate(param);
42         mapper.doMapping(source, target);
43         assertEquals(target.getExpiryDate(), param);
44     }
45
46     @Test
47     void testName() {
48         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
49         EntitlementPoolEntity target = new EntitlementPoolEntity();
50         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
51                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
52         String param = "08c72f48-2cb6-4509-9983-5564c74c1bc8";
53         source.setName(param);
54         mapper.doMapping(source, target);
55         assertEquals(target.getName(), param);
56     }
57
58     @Test
59     void testDescription() {
60         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
61         EntitlementPoolEntity target = new EntitlementPoolEntity();
62         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
63                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
64         String param = "b5161f7b-b5bc-4e98-b242-a8dc99aeab01";
65         source.setDescription(param);
66         mapper.doMapping(source, target);
67         assertEquals(target.getDescription(), param);
68     }
69
70     @Test
71     void testThresholdValue() {
72         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
73         EntitlementPoolEntity target = new EntitlementPoolEntity();
74         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
75                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
76         Integer param = -767970235;
77         source.setThresholdValue(param);
78         mapper.doMapping(source, target);
79         assertEquals(target.getThresholdValue(), param);
80     }
81
82     @Test
83     void testIncrements() {
84         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
85         EntitlementPoolEntity target = new EntitlementPoolEntity();
86         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
87                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
88         String param = "3b760eff-6407-44b7-a1f2-2a87b432f094";
89         source.setIncrements(param);
90         mapper.doMapping(source, target);
91         assertEquals(target.getIncrements(), param);
92     }
93
94     @Test
95     void testOperationalScope() {
96         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
97         EntitlementPoolEntity target = new EntitlementPoolEntity();
98         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
99                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
100         MultiChoiceOrOtherDto<OperationalScope> param = new MultiChoiceOrOtherDto<>();
101         param.setChoices(new HashSet(Collections.singletonList(TestEnum.Yes)));
102         source.setOperationalScope(param);
103         mapper.doMapping(source, target);
104         assertEquals(target.getOperationalScope().getChoices(), param.getChoices());
105     }
106
107     @Test
108     void testStartDate() {
109         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
110         EntitlementPoolEntity target = new EntitlementPoolEntity();
111         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper =
112                 new MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
113         String param = "654f3536-9346-45fb-97f5-6dc24e517e31";
114         source.setStartDate(param);
115         mapper.doMapping(source, target);
116         assertEquals(target.getStartDate(), param);
117     }
118
119     @Test
120     void testManufacturerReferenceNumber() {
121         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
122         EntitlementPoolEntity target = new EntitlementPoolEntity();
123         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = new
124             MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
125         String param = "02402e1e-7092-485a-9574-46e2d49cca97";
126         source.setManufacturerReferenceNumber(param);
127         mapper.doMapping(source, target);
128         assertEquals(target.getManufacturerReferenceNumber(), param);
129     }
130
131     @Test
132     void testType() {
133         EntitlementPoolRequestDto source = new EntitlementPoolRequestDto();
134         EntitlementPoolEntity target = new EntitlementPoolEntity();
135         MapEntitlementPoolRequestDtoToEntitlementPoolEntity mapper = new
136                 MapEntitlementPoolRequestDtoToEntitlementPoolEntity();
137         EntitlementPoolType entitlementPoolType = EntitlementPoolType.Universal;
138         source.setType(entitlementPoolType);
139         mapper.doMapping(source, target);
140         assertEquals(target.getType(), entitlementPoolType);
141     }
142
143     enum TestEnum {
144         Yes
145     }
146 }