1 package org.openecomp.sdc.be.datatypes.elements;
3 import org.apache.commons.collections.map.HashedMap;
4 import org.junit.Assert;
7 import java.util.HashMap;
8 import java.util.LinkedList;
12 public class SchemaDefinitionTest {
14 private SchemaDefinition createTestSubject() {
15 return new SchemaDefinition();
19 public void testConstructors() throws Exception {
20 SchemaDefinition testSubject;
24 testSubject = createTestSubject();
25 new SchemaDefinition("mock", new LinkedList<>(), new HashedMap());
29 public void testGetDerivedFrom() throws Exception {
30 SchemaDefinition testSubject;
34 testSubject = createTestSubject();
35 result = testSubject.getDerivedFrom();
39 public void testSetProperty() throws Exception {
40 SchemaDefinition testSubject;
41 PropertyDataDefinition property = null;
44 testSubject = createTestSubject();
45 testSubject.setProperty(property);
49 public void testGetProperty() throws Exception {
50 SchemaDefinition testSubject;
51 PropertyDataDefinition result;
54 testSubject = createTestSubject();
55 result = testSubject.getProperty();
59 public void testSetDerivedFrom() throws Exception {
60 SchemaDefinition testSubject;
61 String derivedFrom = "";
64 testSubject = createTestSubject();
65 testSubject.setDerivedFrom(derivedFrom);
69 public void testGetConstraints() throws Exception {
70 SchemaDefinition testSubject;
74 testSubject = createTestSubject();
75 result = testSubject.getConstraints();
79 public void testSetConstraints() throws Exception {
80 SchemaDefinition testSubject;
81 List<String> constraints = null;
84 testSubject = createTestSubject();
85 testSubject.setConstraints(constraints);
89 public void testGetProperties() throws Exception {
90 SchemaDefinition testSubject;
91 Map<String, PropertyDataDefinition> result;
94 testSubject = createTestSubject();
95 result = testSubject.getProperties();
99 public void testSetProperties() throws Exception {
100 SchemaDefinition testSubject;
101 Map<String, PropertyDataDefinition> properties = null;
104 testSubject = createTestSubject();
105 testSubject.setProperties(properties);
109 public void testAddProperty() throws Exception {
110 SchemaDefinition testSubject;
112 PropertyDataDefinition property = new PropertyDataDefinition();
115 testSubject = createTestSubject();
116 testSubject.setProperties(new HashMap<>() );
117 testSubject.addProperty("mock", property);
121 public void testHashCode() throws Exception {
122 SchemaDefinition testSubject;
126 testSubject = createTestSubject();
127 result = testSubject.hashCode();
131 public void testEquals() throws Exception {
132 SchemaDefinition testSubject;
137 testSubject = createTestSubject();
139 result = testSubject.equals(obj);
140 Assert.assertEquals(false, result);
141 result = testSubject.equals(testSubject);
142 Assert.assertEquals(true, result);
143 result = testSubject.equals(createTestSubject());
144 Assert.assertEquals(true, result);
148 public void testToString() throws Exception {
149 SchemaDefinition testSubject;
153 testSubject = createTestSubject();
154 result = testSubject.toString();