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;
18 import static org.junit.Assert.assertEquals;
20 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
21 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
22 import com.amdocs.zusammen.datatypes.item.Info;
23 import org.junit.Test;
24 import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity;
26 public class ElementToVLMGeneralConvertorTest {
28 private static final String ENTITY_NAME = "entityTestName";
29 private static final String ENTITY_DESCRIPTION = "entityTestDesc";
31 private ElementToVLMGeneralConvertor converter = new ElementToVLMGeneralConvertor();
34 public void shouldConvertElementToVendorLicenseModelEntity() {
35 ZusammenElement elementToConvert = new ZusammenElement();
36 Info info = new Info();
37 info.addProperty("name",ENTITY_NAME);
38 info.addProperty("description",ENTITY_DESCRIPTION);
39 elementToConvert.setInfo(info);
40 VendorLicenseModelEntity result = converter.convert(elementToConvert);
41 assertEquals(ENTITY_NAME, result.getVendorName());
42 assertEquals(ENTITY_DESCRIPTION, result.getDescription());
48 public void shouldConvertElementInfoToVendorLicenseModelEntity() {
49 ElementInfo elementInfo = new ElementInfo();
50 Info info = new Info();
51 info.addProperty("name",ENTITY_NAME);
52 info.addProperty("description",ENTITY_DESCRIPTION);
53 elementInfo.setInfo(info);
54 VendorLicenseModelEntity result = converter.convert(elementInfo);
55 assertEquals(ENTITY_NAME, result.getVendorName());
56 assertEquals(ENTITY_DESCRIPTION, result.getDescription());