aboutsummaryrefslogtreecommitdiffstats
path: root/policy-management/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-09-30 14:32:56 -0400
committerJim Hahn <jrh3@att.com>2020-09-30 16:29:50 -0400
commitb7239e0e2859d998d5f8448879409eb30c3bc658 (patch)
tree7b9eec66ddaf30200fb4a55c0ceacbdb3035e63e /policy-management/src/test
parent7ee6e75574262ca7419481881313bd60e72bf302 (diff)
Fix new sonars in drools-pdp
Addressed the following sonar issues: - extract common test method - too many assertions in test method - don't always return the same value Issue-ID: POLICY-2616 Change-Id: Iab836cdcd667b35e2db9db7d6ffc7896df33e1c8 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-management/src/test')
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java
index 0b959f05..6b669a2d 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java
@@ -600,20 +600,17 @@ public class AggregatedPolicyControllerTest {
@Test(expected = IllegalArgumentException.class)
public void testDeliver_NullTopic() {
- apc.start();
- apc.deliver(CommInfrastructure.NOOP, null, MY_EVENT);
+ validateDeliverFailure(null, MY_EVENT);
}
@Test(expected = IllegalArgumentException.class)
public void testDeliver_EmptyTopic() {
- apc.start();
- apc.deliver(CommInfrastructure.NOOP, "", MY_EVENT);
+ validateDeliverFailure("", MY_EVENT);
}
@Test(expected = IllegalArgumentException.class)
public void testDeliver_NullEvent() {
- apc.start();
- apc.deliver(CommInfrastructure.NOOP, SINK_TOPIC1, null);
+ validateDeliverFailure(SINK_TOPIC1, null);
}
@Test(expected = IllegalStateException.class)
@@ -788,6 +785,11 @@ public class AggregatedPolicyControllerTest {
assertTrue(apc.toString().startsWith("AggregatedPolicyController ["));
}
+ private void validateDeliverFailure(String topic, String event) {
+ apc.start();
+ apc.deliver(CommInfrastructure.NOOP, topic, event);
+ }
+
/**
* Performs an operation that has a beforeXxx method and an afterXxx method. Tries
* combinations where beforeXxx and afterXxx return {@code true} and {@code false}.