Added oparent to sdc main
[sdc.git] / catalog-model / src / test / java / org / openecomp / sdc / be / model / ComponentMetadataDefinitionTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. 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
21 package org.openecomp.sdc.be.model;
22
23 import org.junit.Assert;
24 import org.junit.Test;
25 import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
26 import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
27
28
29 public class ComponentMetadataDefinitionTest {
30
31         private ComponentMetadataDefinition createTestSubject() {
32                 return new ComponentMetadataDefinition();
33         }
34         
35         @Test
36         public void testCtor() throws Exception {
37                 new ComponentMetadataDefinition(new ResourceMetadataDataDefinition());
38         }
39         
40         @Test
41         public void testGetMetadataDataDefinition() throws Exception {
42                 ComponentMetadataDefinition testSubject;
43                 ComponentMetadataDataDefinition result;
44
45                 // default test
46                 testSubject = createTestSubject();
47                 result = testSubject.getMetadataDataDefinition();
48         }
49
50         
51         @Test
52         public void testHashCode() throws Exception {
53                 ComponentMetadataDefinition testSubject;
54                 int result;
55
56                 // default test
57                 testSubject = createTestSubject();
58                 result = testSubject.hashCode();
59         }
60
61         
62         @Test
63         public void testEquals() throws Exception {
64                 ComponentMetadataDefinition testSubject;
65                 Object obj = null;
66                 boolean result;
67
68                 // test 1
69                 testSubject = createTestSubject();
70                 result = testSubject.equals(obj);
71                 Assert.assertEquals(false, result);
72                 obj = new Object();
73                 result = testSubject.equals(obj);
74                 Assert.assertEquals(false, result);
75                 result = testSubject.equals(testSubject);
76                 Assert.assertEquals(true, result);
77                 result = testSubject.equals(createTestSubject());
78                 Assert.assertEquals(true, result);
79                 ComponentMetadataDefinition testSubject2 = createTestSubject();
80                 testSubject.componentMetadataDataDefinition = new ResourceMetadataDataDefinition();
81                 result = testSubject.equals(testSubject2);
82                 Assert.assertEquals(false, result);
83                 testSubject2.componentMetadataDataDefinition = new ResourceMetadataDataDefinition();
84                 result = testSubject.equals(testSubject2);
85                 Assert.assertEquals(true, result);
86         }
87 }