1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
/*-
* ============LICENSE_START=======================================================
* so
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
public class SoRequestDetailsTest {
@Test
public void testConstructor() {
SoRequestDetails obj = new SoRequestDetails();
assertNull(obj.getCloudConfiguration());
assertNull(obj.getModelInfo());
assertNull(obj.getRequestInfo());
assertNull(obj.getRequestParameters());
assertNull(obj.getSubscriberInfo());
assertNotNull(obj.getRelatedInstanceList());
assertEquals(0, obj.getRelatedInstanceList().size());
}
@Test
public void testSetGet() {
SoRequestDetails obj = new SoRequestDetails();
SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
obj.setCloudConfiguration(cloudConfiguration);
assertEquals(cloudConfiguration, obj.getCloudConfiguration());
SoModelInfo modelInfo = new SoModelInfo();
obj.setModelInfo(modelInfo);
assertEquals(modelInfo, obj.getModelInfo());
SoRequestInfo requestInfo = new SoRequestInfo();
obj.setRequestInfo(requestInfo);
assertEquals(requestInfo, obj.getRequestInfo());
SoRequestParameters requestParameters = new SoRequestParameters();
obj.setRequestParameters(requestParameters);
assertEquals(requestParameters, obj.getRequestParameters());
SoSubscriberInfo subscriberInfo = new SoSubscriberInfo();
obj.setSubscriberInfo(subscriberInfo);
assertEquals(subscriberInfo, obj.getSubscriberInfo());
}
@Test
public void testSoMRequestDetailsMethods() {
SoRequestDetails details = new SoRequestDetails();
assertNotNull(details);
assertNotEquals(0, details.hashCode());
SoCloudConfiguration cloudConfiguration = new SoCloudConfiguration();
details.setCloudConfiguration(cloudConfiguration);
assertEquals(cloudConfiguration, details.getCloudConfiguration());
assertNotEquals(0, details.hashCode());
SoModelInfo modelInfo = new SoModelInfo();
details.setModelInfo(modelInfo);
assertEquals(modelInfo, details.getModelInfo());
assertNotEquals(0, details.hashCode());
List<SoRelatedInstanceListElement> relatedInstanceList = new ArrayList<>();
details.setRelatedInstanceList(relatedInstanceList);
assertEquals(relatedInstanceList, details.getRelatedInstanceList());
assertNotEquals(0, details.hashCode());
SoRequestInfo requestInfo = new SoRequestInfo();
details.setRequestInfo(requestInfo);
assertEquals(requestInfo, details.getRequestInfo());
assertNotEquals(0, details.hashCode());
SoRequestParameters requestParameters = new SoRequestParameters();
details.setRequestParameters(requestParameters);
assertEquals(requestParameters, details.getRequestParameters());
assertNotEquals(0, details.hashCode());
SoSubscriberInfo subscriberInfo = new SoSubscriberInfo();
details.setSubscriberInfo(subscriberInfo);
assertEquals(subscriberInfo, details.getSubscriberInfo());
assertNotEquals(0, details.hashCode());
assertEquals("SORequestDetails [modelInfo=org.onap.policy.so", details.toString().substring(0, 46));
SoRequestDetails copiedDetails = new SoRequestDetails(details);
assertTrue(details.equals(details));
assertTrue(details.equals(copiedDetails));
assertFalse(details.equals(null));
assertFalse(details.equals("Hello"));
details.setCloudConfiguration(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setCloudConfiguration(null);
assertTrue(details.equals(copiedDetails));
details.setCloudConfiguration(cloudConfiguration);
assertFalse(details.equals(copiedDetails));
copiedDetails.setCloudConfiguration(cloudConfiguration);
assertTrue(details.equals(copiedDetails));
details.setModelInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setModelInfo(null);
assertTrue(details.equals(copiedDetails));
details.setModelInfo(modelInfo);
assertFalse(details.equals(copiedDetails));
copiedDetails.setModelInfo(modelInfo);
assertTrue(details.equals(copiedDetails));
details.setRequestInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestInfo(null);
assertTrue(details.equals(copiedDetails));
details.setRequestInfo(requestInfo);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestInfo(requestInfo);
assertTrue(details.equals(copiedDetails));
details.setRequestParameters(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestParameters(null);
assertTrue(details.equals(copiedDetails));
details.setRequestParameters(requestParameters);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestParameters(requestParameters);
assertTrue(details.equals(copiedDetails));
details.setSubscriberInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setSubscriberInfo(null);
assertTrue(details.equals(copiedDetails));
details.setSubscriberInfo(subscriberInfo);
assertFalse(details.equals(copiedDetails));
copiedDetails.setSubscriberInfo(subscriberInfo);
assertTrue(details.equals(copiedDetails));
details.setRelatedInstanceList(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRelatedInstanceList(null);
assertTrue(details.equals(copiedDetails));
details.setRelatedInstanceList(relatedInstanceList);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRelatedInstanceList(relatedInstanceList);
assertTrue(details.equals(copiedDetails));
}
}
|