45660a68549be7c46a4ba6027f410f70a19c4f2c
[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 package org.openecomp.sdc.vendorlicense.dao.impl.zusammen.convertor;
17
18 import static org.junit.Assert.assertEquals;
19
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;
25
26 public class ElementToVLMGeneralConvertorTest {
27
28     private static final String ENTITY_NAME = "entityTestName";
29     private static final String ENTITY_DESCRIPTION = "entityTestDesc";
30
31     private ElementToVLMGeneralConvertor converter = new ElementToVLMGeneralConvertor();
32
33     @Test
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());
43
44
45     }
46
47     @Test
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());
57     }
58
59
60 }