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.
16 package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
19 import static org.junit.Assert.assertEquals;
21 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
22 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
23 import com.amdocs.zusammen.datatypes.Id;
24 import com.amdocs.zusammen.datatypes.item.Info;
25 import org.junit.Test;
26 import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupEntity;
28 public class ElementToFeatureGroupConvertorTest {
30 private static final String ENTITY_ID = "entityId1";
31 private static final String ENTITY_NAME = "entityTestName";
32 private static final String ENTITY_DESCRIPTION = "entityTestDesc";
35 private ElementToFeatureGroupConvertor converter = new ElementToFeatureGroupConvertor();
38 public void shouldConvertElementToFeatureGroupEntity() {
39 ZusammenElement elementToConvert = new ZusammenElement();
40 elementToConvert.setElementId(new Id(ENTITY_ID));
41 elementToConvert.setInfo(createInfo());
42 FeatureGroupEntity result = converter.convert(elementToConvert);
43 assertEquals(ENTITY_ID, result.getId());
44 assertEquals(ENTITY_NAME, result.getName());
45 assertEquals(ENTITY_DESCRIPTION, result.getDescription());
49 public void shouldConvertElementInfoToFeatureGroupEntity(){
50 ElementInfo elementToConvert = new ElementInfo();
51 elementToConvert.setId(new Id(ENTITY_ID));
52 elementToConvert.setInfo(createInfo());
53 FeatureGroupEntity result = converter.convert(elementToConvert);
54 assertEquals(ENTITY_ID, result.getId());
55 assertEquals(ENTITY_NAME, result.getName());
56 assertEquals(ENTITY_DESCRIPTION, result.getDescription());
59 private Info createInfo() {
60 Info info = new Info();
61 info.setName(ENTITY_NAME);
62 info.setDescription(ENTITY_DESCRIPTION);