summaryrefslogtreecommitdiffstats
path: root/main/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/test')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java24
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java17
2 files changed, 8 insertions, 33 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java
index e8c03d1d..fc43c7a9 100644
--- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyCommonTrackerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP PAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -141,9 +141,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport {
tracker.addData(makeData(policy2, PDP1, PDP3));
// remove a policy that isn't in the map
- List<PolicyStatus> statusList = new ArrayList<>();
- tracker.removeData(makeData(policy3, PDP1), statusList);
- assertTrue(statusList.isEmpty());
+ tracker.removeData(makeData(policy3, PDP1));
assertEquals(2, map.size());
}
@@ -155,10 +153,8 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport {
tracker.addData(makeData(policy1, PDP1, PDP2));
tracker.addData(makeData(policy2, PDP1, PDP3));
- // remove some PDPs from a policy - no notifications and no changes to the map
- List<PolicyStatus> statusList = new ArrayList<>();
- tracker.removeData(makeData(policy2, PDP1), statusList);
- assertTrue(statusList.isEmpty());
+ // remove some PDPs from a policy - no changes to the map
+ tracker.removeData(makeData(policy2, PDP1));
assertTrue(map.containsKey(policy1));
assertTrue(map.containsKey(policy2));
}
@@ -180,11 +176,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport {
tracker.addData(makeData(policy2, PDP1, PDP3));
// remove all the PDPs from one policy, but do NOT remove the policy
- List<PolicyStatus> statusList = new ArrayList<>();
- tracker.removeData(makeData(policy2, PDP1, PDP3), statusList);
- assertEquals(1, statusList.size());
- assertEquals(policy2, statusList.get(0).getPolicy());
- assertEquals(type, statusList.get(0).getPolicyType());
+ tracker.removeData(makeData(policy2, PDP1, PDP3));
assertTrue(map.containsKey(policy1));
assertTrue(map.containsKey(policy2));
}
@@ -198,11 +190,7 @@ public class PolicyCommonTrackerTest extends PolicyCommonSupport {
tracker.addData(makeData(policy2, PDP1, PDP3));
// remove all the PDPs from one policy, and remove the policy
- List<PolicyStatus> statusList = new ArrayList<>();
- tracker.removeData(makeData(policy1, PDP1, PDP2, PDP3), statusList);
- assertEquals(1, statusList.size());
- assertEquals(policy1, statusList.get(0).getPolicy());
- assertEquals(type, statusList.get(0).getPolicyType());
+ tracker.removeData(makeData(policy1, PDP1, PDP2, PDP3));
assertFalse(map.containsKey(policy1));
assertTrue(map.containsKey(policy2));
}
diff --git a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java
index 478c63c9..1305f27e 100644
--- a/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/notification/PolicyNotifierTest.java
@@ -22,7 +22,6 @@ package org.onap.policy.pap.main.notification;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -223,32 +222,20 @@ public class PolicyNotifierTest extends PolicyCommonSupport {
@Test
public void testAddDeploymentData() {
- doAnswer(addStatus(1, status1, status2)).when(undeploy).removeData(any(), any());
-
PolicyPdpNotificationData data = makeData(policy1, PDP1, PDP2);
notifier.addDeploymentData(data);
verify(deploy).addData(data);
- verify(undeploy).removeData(eq(data), any());
-
- PolicyNotification notification = getNotification();
- assertEquals(Arrays.asList(status1, status2), notification.getDeleted());
- assertTrue(notification.getAdded().isEmpty());
+ verify(undeploy).removeData(eq(data));
}
@Test
public void testAddUndeploymentData() {
- doAnswer(addStatus(1, status1, status2)).when(deploy).removeData(any(), any());
-
PolicyPdpNotificationData data = makeData(policy1, PDP1, PDP2);
notifier.addUndeploymentData(data);
verify(undeploy).addData(data);
- verify(deploy).removeData(eq(data), any());
-
- PolicyNotification notification = getNotification();
- assertEquals(Arrays.asList(status1, status2), notification.getAdded());
- assertTrue(notification.getDeleted().isEmpty());
+ verify(deploy).removeData(eq(data));
}
@Test