2 * Copyright © 2016-2018 European Support Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.openecomp.sdcrests.vendorlicense.rest.mapping;
19 import static org.testng.Assert.assertEquals;
21 import java.util.Collections;
22 import java.util.HashSet;
24 import org.openecomp.sdc.vendorlicense.dao.types.MultiChoiceOrOther;
25 import org.openecomp.sdcrests.vendorlicense.types.MultiChoiceOrOtherDto;
26 import org.testng.annotations.Test;
29 public class MapMultiChoiceOrOtherToMultiChoiceOrOtherDtoTest {
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);
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);