2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright (C) 2019 Samsung
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.std.test;
25 import java.util.Collection;
26 import java.util.Collections;
27 import java.util.LinkedList;
29 import org.onap.policy.api.LoadedPolicy;
30 import org.onap.policy.api.NotificationType;
31 import org.onap.policy.api.RemovedPolicy;
32 import org.onap.policy.std.StdLoadedPolicy;
33 import org.onap.policy.std.StdPDPNotification;
34 import org.onap.policy.std.StdRemovedPolicy;
35 import static org.junit.Assert.*;
38 * The class <code>StdPDPNotificationTest</code> contains tests for the class
39 * <code>{@link StdPDPNotification}</code>.
41 * @generatedBy CodePro at 6/1/16 1:41 PM
42 * @version $Revision: 1.0 $
44 public class StdPDPNotificationTest {
46 * Run the StdPDPNotification() constructor test.
48 * @generatedBy CodePro at 6/1/16 1:41 PM
51 public void testStdPDPNotification_1() throws Exception {
52 StdPDPNotification result = new StdPDPNotification();
53 assertNotNull(result);
54 // add additional test code here
58 * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
62 * @generatedBy CodePro at 6/1/16 1:41 PM
65 public void testGetLoadedPolicies_1() throws Exception {
66 StdPDPNotification fixture = new StdPDPNotification();
67 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
68 fixture.setNotificationType(NotificationType.BOTH);
69 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
71 Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
73 // add additional test code here
74 assertNotNull(result);
75 assertEquals(0, result.size());
79 * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
83 * @generatedBy CodePro at 6/1/16 1:41 PM
86 public void testGetLoadedPolicies_2() throws Exception {
87 StdPDPNotification fixture = new StdPDPNotification();
88 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
89 fixture.setNotificationType(NotificationType.BOTH);
90 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
92 Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
94 // add additional test code here
95 assertNotNull(result);
96 assertEquals(0, result.size());
100 * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
104 * @generatedBy CodePro at 6/1/16 1:41 PM
107 public void testGetLoadedPolicies_3() throws Exception {
108 StdPDPNotification fixture = new StdPDPNotification();
109 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
110 fixture.setNotificationType(NotificationType.BOTH);
111 fixture.setLoadedPolicies(null);
113 Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
115 // add additional test code here
116 assertEquals(Collections.EMPTY_LIST, result);
120 * Run the NotificationType getNotificationType() method test.
124 * @generatedBy CodePro at 6/1/16 1:41 PM
127 public void testGetNotificationType_1() throws Exception {
128 StdPDPNotification fixture = new StdPDPNotification();
129 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
130 fixture.setNotificationType(NotificationType.BOTH);
131 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
133 NotificationType result = fixture.getNotificationType();
135 // add additional test code here
136 assertNotNull(result);
137 assertEquals("both", result.toString());
138 assertEquals("BOTH", result.name());
139 assertEquals(2, result.ordinal());
143 * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
147 * @generatedBy CodePro at 6/1/16 1:41 PM
150 public void testGetRemovedPolicies_1() throws Exception {
151 StdPDPNotification fixture = new StdPDPNotification();
152 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
153 fixture.setNotificationType(NotificationType.BOTH);
154 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
156 Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
158 // add additional test code here
159 assertNotNull(result);
160 assertEquals(0, result.size());
164 * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
168 * @generatedBy CodePro at 6/1/16 1:41 PM
171 public void testGetRemovedPolicies_2() throws Exception {
172 StdPDPNotification fixture = new StdPDPNotification();
173 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
174 fixture.setNotificationType(NotificationType.BOTH);
175 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
177 Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
179 // add additional test code here
180 assertNotNull(result);
181 assertEquals(0, result.size());
185 * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
189 * @generatedBy CodePro at 6/1/16 1:41 PM
192 public void testGetRemovedPolicies_3() throws Exception {
193 StdPDPNotification fixture = new StdPDPNotification();
194 fixture.setRemovedPolicies(null);
195 fixture.setNotificationType(NotificationType.BOTH);
196 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
198 Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
200 // add additional test code here
201 assertEquals(Collections.EMPTY_LIST, result);
205 * Run the void setNotificationType(NotificationType) method test.
209 * @generatedBy CodePro at 6/1/16 1:41 PM
212 public void testSetNotificationType_1() throws Exception {
213 StdPDPNotification fixture = new StdPDPNotification();
214 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
215 fixture.setNotificationType(NotificationType.BOTH);
216 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
217 NotificationType notificationType = NotificationType.BOTH;
219 fixture.setNotificationType(notificationType);
221 // add additional test code here
225 * Run the void setRemovedPolicies(Collection<StdRemovedPolicy>) method test.
229 * @generatedBy CodePro at 6/1/16 1:41 PM
232 public void testSetRemovedPolicies_1() throws Exception {
233 StdPDPNotification fixture = new StdPDPNotification();
234 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
235 fixture.setNotificationType(NotificationType.BOTH);
236 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
237 Collection<StdRemovedPolicy> removedPolicies = new LinkedList<StdRemovedPolicy>();
239 fixture.setRemovedPolicies(removedPolicies);
241 // add additional test code here
245 * Run the void setUpdatedPolicies(Collection<StdLoadedPolicy>) method test.
249 * @generatedBy CodePro at 6/1/16 1:41 PM
252 public void testSetUpdatedPolicies_1() throws Exception {
253 StdPDPNotification fixture = new StdPDPNotification();
254 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
255 fixture.setNotificationType(NotificationType.BOTH);
256 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
257 Collection<StdLoadedPolicy> updatedPolicies = new LinkedList<StdLoadedPolicy>();
259 fixture.setLoadedPolicies(updatedPolicies);
261 // add additional test code here
265 * Perform pre-test initialization.
267 * @throws Exception if the initialization fails for some reason
269 * @generatedBy CodePro at 6/1/16 1:41 PM
272 public void setUp() throws Exception {
273 // add additional set up code here
277 * Perform post-test clean-up.
279 * @throws Exception if the clean-up fails for some reason
281 * @generatedBy CodePro at 6/1/16 1:41 PM
284 public void tearDown() throws Exception {
285 // Add additional tear down code here
291 * @param args the command line arguments
293 * @generatedBy CodePro at 6/1/16 1:41 PM
295 public static void main(String[] args) {
296 new org.junit.runner.JUnitCore().run(StdPDPNotificationTest.class);