aboutsummaryrefslogtreecommitdiffstats
path: root/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
blob: 6f65a3c74dfa44a3641815a01bbfe7e72a17a284 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * Copyright © 2016-2018 European Support Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openecomp.sdcrests.vendorlicense.rest.mapping;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction;
import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity;
import org.openecomp.sdc.vendorlicense.dao.types.LimitType;
import org.openecomp.sdcrests.vendorlicense.types.LimitEntityDto;
import org.junit.jupiter.api.Test;


class MapLimitEntityToLimitDtoTest {

    @Test
    void testDescription() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "7315b1fa-f797-438a-b0d1-8b652899ecec";
        source.setDescription(param);
        mapper.doMapping(source, target);
        assertEquals(target.getDescription(), param);
    }

    @Test
    void testAggregationFunction() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        AggregationFunction aggregationFunction = AggregationFunction.Average;
        source.setAggregationFunction(aggregationFunction);
        mapper.doMapping(source, target);
        assertEquals(target.getAggregationFunction(), aggregationFunction.toString());
    }

    @Test
    void testType() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        LimitType limitType = LimitType.Vendor;
        source.setType(limitType);
        mapper.doMapping(source, target);
        assertEquals(target.getType(), limitType.toString());
    }

    @Test
    void testUnit() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "94ab5e65-f777-49b7-9328-14af712a3767";
        source.setUnit(param);
        mapper.doMapping(source, target);
        assertEquals(target.getUnit(), param);
    }

    @Test
    void testMetric() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "1fb615b9-8108-485d-83c9-5dbfb14cf953";
        source.setMetric(param);
        mapper.doMapping(source, target);
        assertEquals(target.getMetric(), param);
    }

    @Test
    void testName() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "ab5d6967-0020-4cd2-aeba-ff3e39e52385";
        source.setName(param);
        mapper.doMapping(source, target);
        assertEquals(target.getName(), param);
    }

    @Test
    void testId() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "52d4d919-015a-4a46-af04-4d0dec17e88d";
        source.setId(param);
        mapper.doMapping(source, target);
        assertEquals(target.getId(), param);
    }

    @Test
    void testTime() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "4e19d619-5004-423c-abf2-0d6e69a47a5c";
        source.setTime(param);
        mapper.doMapping(source, target);
        assertEquals(target.getTime(), param);
    }

    @Test
    void testValue() {
        LimitEntity source = new LimitEntity();
        LimitEntityDto target = new LimitEntityDto();
        MapLimitEntityToLimitDto mapper = new MapLimitEntityToLimitDto();
        String param = "13d67707-b02f-40b2-8b19-60fd6405a7af";
        source.setValue(param);
        mapper.doMapping(source, target);
        assertEquals(target.getValue(), param);
    }
}