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.model;
23 import org.junit.Test;
24 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
25 import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames;
27 import java.util.LinkedList;
28 import java.util.List;
31 public class PropertyDefinitionTest {
33 private PropertyDefinition createTestSubject() {
34 return new PropertyDefinition();
38 public void testCtor() throws Exception {
39 new PropertyDefinition(new PropertyDefinition());
40 new PropertyDefinition(new PropertyDataDefinition());
44 public void testPropertyNames() throws Exception {
45 PropertyNames availabiltyZoneCount = PropertyDefinition.PropertyNames.AVAILABILTY_ZONE_COUNT;
49 public void testPropertyNames_GetPropertyName() throws Exception {
50 PropertyDefinition.PropertyNames.AVAILABILTY_ZONE_COUNT.getPropertyName();
54 public void testPropertyNames_GetUpdateBehavior() throws Exception {
55 PropertyDefinition.PropertyNames.AVAILABILTY_ZONE_COUNT.getUpdateBehavior();
59 public void testPropertyNames_FindName() throws Exception {
60 PropertyDefinition.PropertyNames.findName(null);
61 PropertyDefinition.PropertyNames.findName(PropertyDefinition.PropertyNames.AVAILABILTY_ZONE_COUNT.getPropertyName());
65 public void testGroupInstancePropertyValueUpdateBehavior_GetLevelName() throws Exception {
66 PropertyDefinition.GroupInstancePropertyValueUpdateBehavior.NOT_RELEVANT.getLevelName();
70 public void testGroupInstancePropertyValueUpdateBehavior_GetLevelNumber() throws Exception {
71 PropertyDefinition.GroupInstancePropertyValueUpdateBehavior.NOT_RELEVANT.getLevelNumber();
75 public void testGetConstraints() throws Exception {
76 PropertyDefinition testSubject;
77 List<PropertyConstraint> result;
80 testSubject = createTestSubject();
81 result = testSubject.getConstraints();
85 public void testSetConstraints() throws Exception {
86 PropertyDefinition testSubject;
87 List<PropertyConstraint> constraints = null;
90 testSubject = createTestSubject();
91 testSubject.setConstraints(constraints);
95 public void testToString() throws Exception {
96 PropertyDefinition testSubject;
100 testSubject = createTestSubject();
101 result = testSubject.toString();
105 public void testIsDefinition() throws Exception {
106 PropertyDefinition testSubject;
110 testSubject = createTestSubject();
111 result = testSubject.isDefinition();
115 public void testSetDefinition() throws Exception {
116 PropertyDefinition testSubject;
117 boolean definition = false;
120 testSubject = createTestSubject();
121 testSubject.setDefinition(definition);
125 public void testHashCode() throws Exception {
126 PropertyDefinition testSubject;
130 testSubject = createTestSubject();
131 result = testSubject.hashCode();
135 public void testEquals() throws Exception {
136 PropertyDefinition testSubject;
141 testSubject = createTestSubject();
142 result = testSubject.equals(obj);
144 result = testSubject.equals(new Object());
145 result = testSubject.equals(testSubject);
146 PropertyDefinition testSubject2 = createTestSubject();
147 result = testSubject.equals(testSubject2);
148 testSubject2.setConstraints(new LinkedList<>());
149 result = testSubject.equals(testSubject2);
150 testSubject.setConstraints(new LinkedList<>());
151 result = testSubject.equals(testSubject2);
152 testSubject2.setName("mock");
153 result = testSubject.equals(testSubject2);
154 testSubject.setName("mock");
155 result = testSubject.equals(testSubject2);