unit tests - catalog-model
[sdc.git] / catalog-model / src / test / java / org / openecomp / sdc / be / model / utils / TypeCompareUtilsTest.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.utils;
21
22 import static org.junit.Assert.*;
23
24 import java.util.Arrays;
25 import java.util.Collections;
26 import org.junit.Test;
27 import org.openecomp.sdc.be.model.CapabilityTypeDefinition;
28 import org.openecomp.sdc.be.model.GroupTypeDefinition;
29 import org.openecomp.sdc.be.model.PropertyDefinition;
30 import org.openecomp.sdc.be.model.RelationshipTypeDefinition;
31 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
32
33 public class TypeCompareUtilsTest {
34
35     @Test
36     public void checkTypeAlreadyExists() {
37         assertEquals(TypeCompareUtils.typeAlreadyExists().right().value(), StorageOperationStatus.OK);
38     }
39
40     @Test
41     public void checkGroupTypesEquality() {
42         GroupTypeDefinition object1 = new GroupTypeDefinition();
43         GroupTypeDefinition object2 = new GroupTypeDefinition();
44         assertTrue(TypeCompareUtils.isGroupTypesEquals(object1, object1));
45         assertTrue(TypeCompareUtils.isGroupTypesEquals(object1, object2));
46         assertFalse(TypeCompareUtils.isGroupTypesEquals(object1, null));
47     }
48
49     @Test
50     public void checkCapabilityTypesEquality() {
51         CapabilityTypeDefinition object1 = new CapabilityTypeDefinition();
52         CapabilityTypeDefinition object2 = new CapabilityTypeDefinition();
53         assertTrue(TypeCompareUtils.isCapabilityTypesEquals(object1, object1));
54         assertTrue(TypeCompareUtils.isCapabilityTypesEquals(object1, object2));
55         assertFalse(TypeCompareUtils.isCapabilityTypesEquals(object1, null));
56     }
57
58     @Test
59     public void checkRelationshipTypesEquality() {
60         RelationshipTypeDefinition object1 = new RelationshipTypeDefinition();
61         RelationshipTypeDefinition object2 = new RelationshipTypeDefinition();
62         assertTrue(TypeCompareUtils.isRelationshipTypesEquals(object1, object1));
63         assertTrue(TypeCompareUtils.isRelationshipTypesEquals(object1, object2));
64         assertFalse(TypeCompareUtils.isRelationshipTypesEquals(object1, null));
65     }
66
67     @Test
68     public void checkPropertyDefinitionEquality() {
69         PropertyDefinition object1 = new PropertyDefinition();
70         PropertyDefinition object2 = new PropertyDefinition();
71         assertTrue(TypeCompareUtils.propertiesEquals(
72             Collections.singletonList(object1), Collections.singletonList(object1)));
73         assertTrue(TypeCompareUtils.propertiesEquals(
74             Collections.singletonList(object1), Collections.singletonList(object2)));
75         assertFalse(TypeCompareUtils.propertiesEquals(
76             Collections.singletonList(object1), null));
77     }
78 }