2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.datatypes.elements;
23 import org.apache.commons.collections.map.HashedMap;
24 import org.junit.Assert;
25 import org.junit.Test;
27 import java.util.HashMap;
28 import java.util.LinkedList;
29 import java.util.List;
32 public class SchemaDefinitionTest {
34 private SchemaDefinition createTestSubject() {
35 return new SchemaDefinition();
39 public void testConstructors() throws Exception {
40 SchemaDefinition testSubject;
44 testSubject = createTestSubject();
45 new SchemaDefinition("mock", new LinkedList<>(), new HashedMap());
49 public void testGetDerivedFrom() throws Exception {
50 SchemaDefinition testSubject;
54 testSubject = createTestSubject();
55 result = testSubject.getDerivedFrom();
59 public void testSetProperty() throws Exception {
60 SchemaDefinition testSubject;
61 PropertyDataDefinition property = null;
64 testSubject = createTestSubject();
65 testSubject.setProperty(property);
69 public void testGetProperty() throws Exception {
70 SchemaDefinition testSubject;
71 PropertyDataDefinition result;
74 testSubject = createTestSubject();
75 result = testSubject.getProperty();
79 public void testSetDerivedFrom() throws Exception {
80 SchemaDefinition testSubject;
81 String derivedFrom = "";
84 testSubject = createTestSubject();
85 testSubject.setDerivedFrom(derivedFrom);
89 public void testGetConstraints() throws Exception {
90 SchemaDefinition testSubject;
94 testSubject = createTestSubject();
95 result = testSubject.getConstraints();
99 public void testSetConstraints() throws Exception {
100 SchemaDefinition testSubject;
101 List<String> constraints = null;
104 testSubject = createTestSubject();
105 testSubject.setConstraints(constraints);
109 public void testGetProperties() throws Exception {
110 SchemaDefinition testSubject;
111 Map<String, PropertyDataDefinition> result;
114 testSubject = createTestSubject();
115 result = testSubject.getProperties();
119 public void testSetProperties() throws Exception {
120 SchemaDefinition testSubject;
121 Map<String, PropertyDataDefinition> properties = null;
124 testSubject = createTestSubject();
125 testSubject.setProperties(properties);
129 public void testAddProperty() throws Exception {
130 SchemaDefinition testSubject;
132 PropertyDataDefinition property = new PropertyDataDefinition();
135 testSubject = createTestSubject();
136 testSubject.setProperties(new HashMap<>() );
137 testSubject.addProperty("mock", property);
141 public void testHashCode() throws Exception {
142 SchemaDefinition testSubject;
146 testSubject = createTestSubject();
147 result = testSubject.hashCode();
151 public void testEquals() throws Exception {
152 SchemaDefinition testSubject;
157 testSubject = createTestSubject();
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);
168 public void testToString() throws Exception {
169 SchemaDefinition testSubject;
173 testSubject = createTestSubject();
174 result = testSubject.toString();