2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.onap.policy.std.test;
23 import java.util.Collection;
24 import java.util.Collections;
25 import java.util.LinkedList;
28 import org.onap.policy.api.LoadedPolicy;
29 import org.onap.policy.api.NotificationType;
30 import org.onap.policy.api.RemovedPolicy;
31 import org.onap.policy.std.StdLoadedPolicy;
32 import org.onap.policy.std.StdPDPNotification;
33 import org.onap.policy.std.StdRemovedPolicy;
35 import static org.junit.Assert.*;
38 * The class <code>StdPDPNotificationTest</code> contains tests for the class <code>{@link StdPDPNotification}</code>.
40 * @generatedBy CodePro at 6/1/16 1:41 PM
41 * @version $Revision: 1.0 $
43 public class StdPDPNotificationTest {
45 * Run the StdPDPNotification() constructor test.
47 * @generatedBy CodePro at 6/1/16 1:41 PM
50 public void testStdPDPNotification_1()
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()
67 StdPDPNotification fixture = new StdPDPNotification();
68 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
69 fixture.setNotificationType(NotificationType.BOTH);
70 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
72 Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
74 // add additional test code here
75 assertNotNull(result);
76 assertEquals(0, result.size());
80 * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
84 * @generatedBy CodePro at 6/1/16 1:41 PM
87 public void testGetLoadedPolicies_2()
89 StdPDPNotification fixture = new StdPDPNotification();
90 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
91 fixture.setNotificationType(NotificationType.BOTH);
92 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
94 Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
96 // add additional test code here
97 assertNotNull(result);
98 assertEquals(0, result.size());
102 * Run the Collection<LoadedPolicy> getLoadedPolicies() method test.
106 * @generatedBy CodePro at 6/1/16 1:41 PM
109 public void testGetLoadedPolicies_3()
111 StdPDPNotification fixture = new StdPDPNotification();
112 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
113 fixture.setNotificationType(NotificationType.BOTH);
114 fixture.setLoadedPolicies(null);
116 Collection<LoadedPolicy> result = fixture.getLoadedPolicies();
118 // add additional test code here
119 assertEquals(Collections.EMPTY_LIST, result);
123 * Run the NotificationType getNotificationType() method test.
127 * @generatedBy CodePro at 6/1/16 1:41 PM
130 public void testGetNotificationType_1()
132 StdPDPNotification fixture = new StdPDPNotification();
133 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
134 fixture.setNotificationType(NotificationType.BOTH);
135 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
137 NotificationType result = fixture.getNotificationType();
139 // add additional test code here
140 assertNotNull(result);
141 assertEquals("both", result.toString());
142 assertEquals("BOTH", result.name());
143 assertEquals(2, result.ordinal());
147 * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
151 * @generatedBy CodePro at 6/1/16 1:41 PM
154 public void testGetRemovedPolicies_1()
156 StdPDPNotification fixture = new StdPDPNotification();
157 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
158 fixture.setNotificationType(NotificationType.BOTH);
159 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
161 Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
163 // add additional test code here
164 assertNotNull(result);
165 assertEquals(0, result.size());
169 * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
173 * @generatedBy CodePro at 6/1/16 1:41 PM
176 public void testGetRemovedPolicies_2()
178 StdPDPNotification fixture = new StdPDPNotification();
179 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
180 fixture.setNotificationType(NotificationType.BOTH);
181 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
183 Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
185 // add additional test code here
186 assertNotNull(result);
187 assertEquals(0, result.size());
191 * Run the Collection<RemovedPolicy> getRemovedPolicies() method test.
195 * @generatedBy CodePro at 6/1/16 1:41 PM
198 public void testGetRemovedPolicies_3()
200 StdPDPNotification fixture = new StdPDPNotification();
201 fixture.setRemovedPolicies(null);
202 fixture.setNotificationType(NotificationType.BOTH);
203 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
205 Collection<RemovedPolicy> result = fixture.getRemovedPolicies();
207 // add additional test code here
208 assertEquals(Collections.EMPTY_LIST, result);
212 * Run the void setNotificationType(NotificationType) method test.
216 * @generatedBy CodePro at 6/1/16 1:41 PM
219 public void testSetNotificationType_1()
221 StdPDPNotification fixture = new StdPDPNotification();
222 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
223 fixture.setNotificationType(NotificationType.BOTH);
224 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
225 NotificationType notificationType = NotificationType.BOTH;
227 fixture.setNotificationType(notificationType);
229 // add additional test code here
233 * Run the void setRemovedPolicies(Collection<StdRemovedPolicy>) method test.
237 * @generatedBy CodePro at 6/1/16 1:41 PM
240 public void testSetRemovedPolicies_1()
242 StdPDPNotification fixture = new StdPDPNotification();
243 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
244 fixture.setNotificationType(NotificationType.BOTH);
245 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
246 Collection<StdRemovedPolicy> removedPolicies = new LinkedList<StdRemovedPolicy>();
248 fixture.setRemovedPolicies(removedPolicies);
250 // add additional test code here
254 * Run the void setUpdatedPolicies(Collection<StdLoadedPolicy>) method test.
258 * @generatedBy CodePro at 6/1/16 1:41 PM
261 public void testSetUpdatedPolicies_1()
263 StdPDPNotification fixture = new StdPDPNotification();
264 fixture.setRemovedPolicies(new LinkedList<StdRemovedPolicy>());
265 fixture.setNotificationType(NotificationType.BOTH);
266 fixture.setLoadedPolicies(new LinkedList<StdLoadedPolicy>());
267 Collection<StdLoadedPolicy> updatedPolicies = new LinkedList<StdLoadedPolicy>();
269 fixture.setLoadedPolicies(updatedPolicies);
271 // add additional test code here
275 * Perform pre-test initialization.
278 * if the initialization fails for some reason
280 * @generatedBy CodePro at 6/1/16 1:41 PM
285 // add additional set up code here
289 * Perform post-test clean-up.
292 * if the clean-up fails for some reason
294 * @generatedBy CodePro at 6/1/16 1:41 PM
297 public void tearDown()
299 // Add additional tear down code here
305 * @param args the command line arguments
307 * @generatedBy CodePro at 6/1/16 1:41 PM
309 public static void main(String[] args) {
310 new org.junit.runner.JUnitCore().run(StdPDPNotificationTest.class);