a0db43e4cd16d68034b1d9a098e1df67eec5cfd1
[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 / MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest.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 java.util.Collections;
22 import java.util.HashSet;
23 import java.util.Set;
24 import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
25 import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto;
26 import org.testng.annotations.Test;
27
28
29 public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest {
30
31     @Test
32     public void testOther() {
33         MultiChoiceOrOther source = new MultiChoiceOrOther();
34         MultiChoiceOrOtherDto target = new MultiChoiceOrOtherDto();
35         MapMultiChoiceOrOtherToMultiChoiceOrOtherDto mapper = new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto();
36         String param = "32a675f1-c1ab-4d15-a6f4-9c1a07d6ce60";
37         source.setOther(param);
38         mapper.doMapping(source, target);
39         assertEquals(target.getOther(), param);
40     }
41
42     @Test
43     public void testChoices() {
44         MultiChoiceOrOther source = new MultiChoiceOrOther();
45         MultiChoiceOrOtherDto target = new MultiChoiceOrOtherDto();
46         MapMultiChoiceOrOtherToMultiChoiceOrOtherDto mapper = new MapMultiChoiceOrOtherToMultiChoiceOrOtherDto();
47         mapper.doMapping(source, target);
48         assertEquals(target.getChoices(), source.getChoices());
49         Set<String> param = new HashSet<>(Collections.singletonList("ed6f5011-d9ef-4f27-8b10-ab8142296a9b"));
50         source.setChoices(param);
51         mapper.doMapping(source, target);
52         assertEquals(target.getChoices(), param);
53     }
54 }