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