ebac7b1b125c8cf77bb9f90506e7613bda5a661e
[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.Id;
23 import com.amdocs.zusammen.datatypes.item.Info;
24 import org.junit.Test;
25 import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolEntity;
26
27 public class ElementToEntitlementPoolConvertorTest {
28
29     private static final String ENTITY_ID = "entityId1";
30     private static final String ENTITY_NAME = "entityTestName";
31     private static final String ENTITY_DESCRIPTION = "entityTestDesc";
32
33     private ElementToEntitlementPoolConvertor converter = new ElementToEntitlementPoolConvertor();
34
35
36     @Test
37     public void shouldConvertElementToEntitlementPoolEntity() {
38         ZusammenElement elementToConvert = new ZusammenElement();
39         elementToConvert.setElementId(new Id(ENTITY_ID));
40         elementToConvert.setInfo(createInfo());
41         EntitlementPoolEntity result = converter.convert(elementToConvert);
42         assertEquals(ENTITY_ID, result.getId());
43         assertEquals(ENTITY_NAME, result.getName());
44         assertEquals(ENTITY_DESCRIPTION, result.getDescription());
45     }
46
47     @Test
48     public void shouldConvertElementInfoToEntitlementPoolEntity(){
49         ElementInfo elementToConvert = new ElementInfo();
50         elementToConvert.setId(new Id(ENTITY_ID));
51         elementToConvert.setInfo(createInfo());
52         EntitlementPoolEntity result = converter.convert(elementToConvert);
53         assertEquals(ENTITY_ID, result.getId());
54         assertEquals(ENTITY_NAME, result.getName());
55         assertEquals(ENTITY_DESCRIPTION, result.getDescription());
56     }
57
58     private Info createInfo() {
59         Info info = new Info();
60         info.setName(ENTITY_NAME);
61         info.setDescription(ENTITY_DESCRIPTION);
62         return info;
63     }
64 }