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 / MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest.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 import static org.junit.jupiter.api.Assertions.assertEquals;
20
21 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity;
22 import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType;
23 import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
24 import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
25 import org.openecomp.sdcrests.vendorlicense.types.LicenseKeyGroupRequestDto;
26 import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto;
27 import org.junit.jupiter.api.Test;
28
29
30 class MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntityTest {
31
32
33     @Test
34     void testExpiryDate() {
35         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
36         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
37         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
38                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
39         String param = "77d85090-e40d-49d0-ae18-b6aff51728e3";
40         source.setExpiryDate(param);
41         mapper.doMapping(source, target);
42         assertEquals(target.getExpiryDate(), param);
43     }
44
45     @Test
46     void testThresholdUnits() {
47         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
48         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
49         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
50                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
51         ThresholdUnit thresholdUnit = ThresholdUnit.Absolute;
52         source.setThresholdUnits(thresholdUnit);
53         mapper.doMapping(source, target);
54         assertEquals(target.getThresholdUnits(), thresholdUnit);
55     }
56
57     @Test
58     void testName() {
59         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
60         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
61         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
62                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
63         String param = "74ee9b26-9a6c-48a4-b3ec-f9a0fe174bc9";
64         source.setName(param);
65         mapper.doMapping(source, target);
66         assertEquals(target.getName(), param);
67     }
68
69     @Test
70     void testDescription() {
71         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
72         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
73         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
74                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
75         String param = "a7aaa0f0-bd68-41b0-a27e-d4e62b1bd6e5";
76         source.setDescription(param);
77         mapper.doMapping(source, target);
78         assertEquals(target.getDescription(), param);
79     }
80
81     @Test
82     void testThresholdValue() {
83         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
84         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
85         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
86                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
87         Integer param = -2136417915;
88         source.setThresholdValue(param);
89         mapper.doMapping(source, target);
90         assertEquals(target.getThresholdValue(), param);
91     }
92
93     @Test
94     void testType() {
95         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
96         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
97         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
98                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
99         LicenseKeyType licenseKeyType = LicenseKeyType.Unique;
100         source.setType(licenseKeyType);
101         mapper.doMapping(source, target);
102         assertEquals(target.getType(), licenseKeyType);
103     }
104
105     @Test
106     void testIncrements() {
107         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
108         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
109         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
110                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
111         String param = "97f20c3a-6f3a-42cf-aa1a-870ba436bde6";
112         source.setIncrements(param);
113         mapper.doMapping(source, target);
114         assertEquals(target.getIncrements(), param);
115     }
116
117     @Test
118     void testOperationalScope() {
119         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
120         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
121         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
122                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
123         MultiChoiceOrOtherDto<OperationalScope> operationalScopeMultiChoiceOrOtherDto = new MultiChoiceOrOtherDto<>();
124         source.setOperationalScope(operationalScopeMultiChoiceOrOtherDto);
125         mapper.doMapping(source, target);
126         assertEquals(target.getOperationalScope().getChoices(), operationalScopeMultiChoiceOrOtherDto.getChoices());
127     }
128
129     @Test
130     void testStartDate() {
131         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
132         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
133         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper =
134                 new MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
135         String param = "9aa18de7-ca80-4690-b604-2e0994424f2d";
136         source.setStartDate(param);
137         mapper.doMapping(source, target);
138         assertEquals(target.getStartDate(), param);
139     }
140
141     @Test
142     void testManufacturerReferenceNumber() {
143         LicenseKeyGroupRequestDto source = new LicenseKeyGroupRequestDto();
144         LicenseKeyGroupEntity target = new LicenseKeyGroupEntity();
145         MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity mapper = new
146             MapLicenseKeyGroupRequestDtoToLicenseKeyGroupEntity();
147         String param = "02402e1e-7092-485a-9574-46e2d49cca97";
148         source.setManufacturerReferenceNumber(param);
149         mapper.doMapping(source, target);
150         assertEquals(target.getManufacturerReferenceNumber(), param);
151     }
152 }