d8034dd65b82902d5c77aad86069e97ddb52d040
[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 / MapLimitEntityToLimitDtoTest.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.testng.Assert.assertEquals;
20
21 import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
22 import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
23 import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
24 import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
25 import org.testng.annotations.Test;
26
27
28 public class MapLimitEntityToLimitDtoTest {
29
30     @Test
31     public void testDescription() {
32         LimitEntity source = new LimitEntity();
33         LimitEntityDto target = new LimitEntityDto();
34         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
35         String param = "7315b1fa-f797-438a-b0d1-8b652899ecec";
36         source.setDescription(param);
37         mapper.doMapping(source, target);
38         assertEquals(target.getDescription(), param);
39     }
40
41     @Test
42     public void testAggregationFunction() {
43         LimitEntity source = new LimitEntity();
44         LimitEntityDto target = new LimitEntityDto();
45         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
46         AggregationFunction aggregationFunction = AggregationFunction.Average;
47         source.setAggregationFunction(aggregationFunction);
48         mapper.doMapping(source, target);
49         assertEquals(target.getAggregationFunction(), aggregationFunction.toString());
50     }
51
52     @Test
53     public void testType() {
54         LimitEntity source = new LimitEntity();
55         LimitEntityDto target = new LimitEntityDto();
56         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
57         LimitType limitType = LimitType.Vendor;
58         source.setType(limitType);
59         mapper.doMapping(source, target);
60         assertEquals(target.getType(), limitType.toString());
61     }
62
63     @Test
64     public void testUnit() {
65         LimitEntity source = new LimitEntity();
66         LimitEntityDto target = new LimitEntityDto();
67         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
68         String param = "94ab5e65-f777-49b7-9328-14af712a3767";
69         source.setUnit(param);
70         mapper.doMapping(source, target);
71         assertEquals(target.getUnit(), param);
72     }
73
74     @Test
75     public void testMetric() {
76         LimitEntity source = new LimitEntity();
77         LimitEntityDto target = new LimitEntityDto();
78         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
79         String param = "1fb615b9-8108-485d-83c9-5dbfb14cf953";
80         source.setMetric(param);
81         mapper.doMapping(source, target);
82         assertEquals(target.getMetric(), param);
83     }
84
85     @Test
86     public void testName() {
87         LimitEntity source = new LimitEntity();
88         LimitEntityDto target = new LimitEntityDto();
89         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
90         String param = "ab5d6967-0020-4cd2-aeba-ff3e39e52385";
91         source.setName(param);
92         mapper.doMapping(source, target);
93         assertEquals(target.getName(), param);
94     }
95
96     @Test
97     public void testId() {
98         LimitEntity source = new LimitEntity();
99         LimitEntityDto target = new LimitEntityDto();
100         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
101         String param = "52d4d919-015a-4a46-af04-4d0dec17e88d";
102         source.setId(param);
103         mapper.doMapping(source, target);
104         assertEquals(target.getId(), param);
105     }
106
107     @Test
108     public void testTime() {
109         LimitEntity source = new LimitEntity();
110         LimitEntityDto target = new LimitEntityDto();
111         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
112         String param = "4e19d619-5004-423c-abf2-0d6e69a47a5c";
113         source.setTime(param);
114         mapper.doMapping(source, target);
115         assertEquals(target.getTime(), param);
116     }
117
118     @Test
119     public void testValue() {
120         LimitEntity source = new LimitEntity();
121         LimitEntityDto target = new LimitEntityDto();
122         MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
123         String param = "13d67707-b02f-40b2-8b19-60fd6405a7af";
124         source.setValue(param);
125         mapper.doMapping(source, target);
126         assertEquals(target.getValue(), param);
127     }
128 }