044e9e0c57ab561384da97a423636c655a6ae594
[sdc.git] / catalog-model / src / test / java / org / openecomp / sdc / be / model / ComponentInstanceInterfaceBeanTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 Nokia. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.sdc.be.model;
21
22 import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertThat;
25
26 import org.junit.Test;
27 import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
28 import org.openecomp.sdc.be.datatypes.elements.InterfaceInstanceDataDefinition;
29
30 public class ComponentInstanceInterfaceBeanTest {
31
32     private static final String INTERFACE_ID = "interfaceId";
33     private static final InterfaceDataDefinition INTERFACE_DATA_DEFINITION = new InterfaceDataDefinition();
34     private static final InterfaceInstanceDataDefinition INTERFACE_INSTANCE_DATA_DEFINITION = new InterfaceInstanceDataDefinition();
35     private static final String ID = "ID";
36
37     @Test
38     public void shouldHaveValidGettersAndSetters() {
39         assertThat(ComponentInstanceInterface.class,
40             hasValidGettersAndSettersExcluding(
41                 "definition",
42                 "ownerIdIfEmpty",
43                 "empty",
44                 "operationsMap",
45                 "version"));
46     }
47
48     @Test
49     public void verifyConstructors() {
50         INTERFACE_DATA_DEFINITION.setUniqueId(ID);
51         ComponentInstanceInterface componentInstanceInterface1 = new ComponentInstanceInterface(INTERFACE_ID,
52             INTERFACE_DATA_DEFINITION);
53         ComponentInstanceInterface componentInstanceInterface2 = new ComponentInstanceInterface(INTERFACE_ID,
54             INTERFACE_INSTANCE_DATA_DEFINITION);
55
56         assertEquals(componentInstanceInterface1.getInterfaceId(), INTERFACE_ID);
57         assertEquals(componentInstanceInterface2.getInterfaceId(), INTERFACE_ID);
58         assertEquals(componentInstanceInterface1.getUniqueId(), ID);
59         assertEquals(componentInstanceInterface2.getInterfaceInstanceDataDefinition(), INTERFACE_INSTANCE_DATA_DEFINITION);
60     }
61 }