Added oparent to sdc main
[sdc.git] / common-be / src / test / java / org / openecomp / sdc / be / datatypes / elements / SchemaDefinitionTest.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.datatypes.elements;
22
23 import org.apache.commons.collections.map.HashedMap;
24 import org.junit.Assert;
25 import org.junit.Test;
26
27 import java.util.HashMap;
28 import java.util.LinkedList;
29 import java.util.List;
30 import java.util.Map;
31
32 public class SchemaDefinitionTest {
33
34         private SchemaDefinition createTestSubject() {
35                 return new SchemaDefinition();
36         }
37         
38         @Test
39         public void testConstructors() throws Exception {
40                 SchemaDefinition testSubject;
41                 String result;
42
43                 // default test
44                 testSubject = createTestSubject();
45                 new SchemaDefinition("mock", new LinkedList<>(), new HashedMap());
46         }
47         
48         @Test
49         public void testGetDerivedFrom() throws Exception {
50                 SchemaDefinition testSubject;
51                 String result;
52
53                 // default test
54                 testSubject = createTestSubject();
55                 result = testSubject.getDerivedFrom();
56         }
57
58         @Test
59         public void testSetProperty() throws Exception {
60                 SchemaDefinition testSubject;
61                 PropertyDataDefinition property = null;
62
63                 // default test
64                 testSubject = createTestSubject();
65                 testSubject.setProperty(property);
66         }
67
68         @Test
69         public void testGetProperty() throws Exception {
70                 SchemaDefinition testSubject;
71                 PropertyDataDefinition result;
72
73                 // default test
74                 testSubject = createTestSubject();
75                 result = testSubject.getProperty();
76         }
77
78         @Test
79         public void testSetDerivedFrom() throws Exception {
80                 SchemaDefinition testSubject;
81                 String derivedFrom = "";
82
83                 // default test
84                 testSubject = createTestSubject();
85                 testSubject.setDerivedFrom(derivedFrom);
86         }
87
88         @Test
89         public void testGetConstraints() throws Exception {
90                 SchemaDefinition testSubject;
91                 List<String> result;
92
93                 // default test
94                 testSubject = createTestSubject();
95                 result = testSubject.getConstraints();
96         }
97
98         @Test
99         public void testSetConstraints() throws Exception {
100                 SchemaDefinition testSubject;
101                 List<String> constraints = null;
102
103                 // default test
104                 testSubject = createTestSubject();
105                 testSubject.setConstraints(constraints);
106         }
107
108         @Test
109         public void testGetProperties() throws Exception {
110                 SchemaDefinition testSubject;
111                 Map<String, PropertyDataDefinition> result;
112
113                 // default test
114                 testSubject = createTestSubject();
115                 result = testSubject.getProperties();
116         }
117
118         @Test
119         public void testSetProperties() throws Exception {
120                 SchemaDefinition testSubject;
121                 Map<String, PropertyDataDefinition> properties = null;
122
123                 // default test
124                 testSubject = createTestSubject();
125                 testSubject.setProperties(properties);
126         }
127
128         @Test
129         public void testAddProperty() throws Exception {
130                 SchemaDefinition testSubject;
131                 String key = "";
132                 PropertyDataDefinition property = new PropertyDataDefinition();
133
134                 // default test
135                 testSubject = createTestSubject();
136                 testSubject.setProperties(new HashMap<>() );
137                 testSubject.addProperty("mock", property);
138         }
139
140         @Test
141         public void testHashCode() throws Exception {
142                 SchemaDefinition testSubject;
143                 int result;
144
145                 // default test
146                 testSubject = createTestSubject();
147                 result = testSubject.hashCode();
148         }
149
150         @Test
151         public void testEquals() throws Exception {
152                 SchemaDefinition testSubject;
153                 Object obj = null;
154                 boolean result;
155
156                 // test 1
157                 testSubject = createTestSubject();
158                 obj = null;
159                 result = testSubject.equals(obj);
160                 Assert.assertEquals(false, result);
161                 result = testSubject.equals(testSubject);
162                 Assert.assertEquals(true, result);
163                 result = testSubject.equals(createTestSubject());
164                 Assert.assertEquals(true, result);
165         }
166
167         @Test
168         public void testToString() throws Exception {
169                 SchemaDefinition testSubject;
170                 String result;
171
172                 // default test
173                 testSubject = createTestSubject();
174                 result = testSubject.toString();
175         }
176 }