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.Assert;
24 import org.junit.Test;
25 import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
27 public class RelationshipInfoTest {
29 private RelationshipInfo createTestSubject() {
30 return new RelationshipInfo();
34 public void testCtor() throws Exception {
35 new RelationshipInfo("mock", new RelationshipImpl());
36 new RelationshipInfo("mock", new RelationshipImpl(), "mock");
40 public void testGetRequirement() throws Exception {
41 RelationshipInfo testSubject;
45 testSubject = createTestSubject();
46 result = testSubject.getRequirement();
50 public void testSetRequirement() throws Exception {
51 RelationshipInfo testSubject;
52 String requirement = "";
55 testSubject = createTestSubject();
56 testSubject.setRequirement(requirement);
60 public void testGetCapabilityOwnerId() throws Exception {
61 RelationshipInfo testSubject;
65 testSubject = createTestSubject();
66 result = testSubject.getCapabilityOwnerId();
70 public void testSetCapabilityOwnerId() throws Exception {
71 RelationshipInfo testSubject;
72 String capabilityOwnerId = "";
75 testSubject = createTestSubject();
76 testSubject.setCapabilityOwnerId(capabilityOwnerId);
80 public void testGetRequirementOwnerId() throws Exception {
81 RelationshipInfo testSubject;
85 testSubject = createTestSubject();
86 result = testSubject.getRequirementOwnerId();
90 public void testSetRequirementOwnerId() throws Exception {
91 RelationshipInfo testSubject;
92 String requirementOwnerId = "";
95 testSubject = createTestSubject();
96 testSubject.setRequirementOwnerId(requirementOwnerId);
100 public void testGetRelationship() throws Exception {
101 RelationshipInfo testSubject;
102 RelationshipImpl result;
105 testSubject = createTestSubject();
106 result = testSubject.getRelationship();
110 public void testSetRelationships() throws Exception {
111 RelationshipInfo testSubject;
112 RelationshipImpl relationship = null;
115 testSubject = createTestSubject();
116 testSubject.setRelationships(relationship);
120 public void testGetCapability() throws Exception {
121 RelationshipInfo testSubject;
125 testSubject = createTestSubject();
126 result = testSubject.getCapability();
130 public void testSetCapability() throws Exception {
131 RelationshipInfo testSubject;
132 String capability = "";
135 testSubject = createTestSubject();
136 testSubject.setCapability(capability);
140 public void testGetCapabilityUid() throws Exception {
141 RelationshipInfo testSubject;
145 testSubject = createTestSubject();
146 result = testSubject.getCapabilityUid();
150 public void testSetCapabilityUid() throws Exception {
151 RelationshipInfo testSubject;
152 String capabilityUid = "";
155 testSubject = createTestSubject();
156 testSubject.setCapabilityUid(capabilityUid);
160 public void testGetRequirementUid() throws Exception {
161 RelationshipInfo testSubject;
165 testSubject = createTestSubject();
166 result = testSubject.getRequirementUid();
170 public void testSetRequirementUid() throws Exception {
171 RelationshipInfo testSubject;
172 String requirementUid = "";
175 testSubject = createTestSubject();
176 testSubject.setRequirementUid(requirementUid);
180 public void testGetId() throws Exception {
181 RelationshipInfo testSubject;
185 testSubject = createTestSubject();
186 result = testSubject.getId();
190 public void testSetId() throws Exception {
191 RelationshipInfo testSubject;
195 testSubject = createTestSubject();
196 testSubject.setId(id);
200 public void testToString() throws Exception {
201 RelationshipInfo testSubject;
205 testSubject = createTestSubject();
206 result = testSubject.toString();
210 public void testEqualsTo() throws Exception {
211 RelationshipInfo testSubject;
212 RelationshipInstDataDefinition savedRelation = null;
216 testSubject = createTestSubject();
217 result = testSubject.equalsTo(savedRelation);
218 Assert.assertEquals(false, result);
219 savedRelation = new RelationshipInstDataDefinition();
220 RelationshipImpl relationship = new RelationshipImpl();
221 savedRelation.setType("mock");
222 testSubject.setRelationships(relationship);
223 result = testSubject.equalsTo(savedRelation);
224 Assert.assertEquals(false, result);
225 relationship.setType("mock");
226 savedRelation.setCapabilityOwnerId("mock");
227 result = testSubject.equalsTo(savedRelation);
228 Assert.assertEquals(false, result);
229 testSubject.setCapabilityOwnerId("mock");
230 savedRelation.setRequirementOwnerId("mock");
231 result = testSubject.equalsTo(savedRelation);
232 Assert.assertEquals(false, result);
233 savedRelation.setRequirementOwnerId("mock");
234 result = testSubject.equalsTo(savedRelation);
235 Assert.assertEquals(false, result);
236 testSubject.setRequirementOwnerId("mock");
237 savedRelation.setRequirementId("mock");
238 result = testSubject.equalsTo(savedRelation);
239 Assert.assertEquals(false, result);
240 testSubject.setRequirementUid("mock");
241 savedRelation.setCapabilityId("mock");
242 result = testSubject.equalsTo(savedRelation);
243 Assert.assertEquals(false, result);
244 testSubject.setCapabilityUid("mock");
245 savedRelation.setRequirement("mock");
246 result = testSubject.equalsTo(savedRelation);
247 Assert.assertEquals(false, result);
248 testSubject.setRequirement("mock");
249 result = testSubject.equalsTo(savedRelation);
250 Assert.assertEquals(true, result);