aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-07-06 16:03:22 -0400
committerJim Hahn <jrh3@att.com>2021-07-06 16:24:57 -0400
commita87b9d9e191b4dee5d821db55d1ff4fd70b8d73a (patch)
treecc9440c171b4a9779030bd53c9f78ab566c30433 /main/src/test/java/org
parent4f37fcf24755332c256f72104df36a43cb4c7560 (diff)
Fix NPE in UpdateReq.reconfigure()
While running CSIT to test heartbeat changes with multiple PAPs, observed an NPE in UpdateReq.reconfigure(). Modified the code to always use deployment lists instead of null lists. Issue-ID: POLICY-3460 Change-Id: I884e091817e88309330139a01d060e286bd42008 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test/java/org')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java
index c318a035..6ea874d8 100644
--- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java
+++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateReqTest.java
@@ -22,6 +22,7 @@
package org.onap.policy.pap.main.comm.msgdata;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -198,6 +199,16 @@ public class UpdateReqTest extends CommonRequestBase {
msg2.setPdpGroup(DIFFERENT);
assertTrue(data.reconfigure(msg2));
assertSame(msg2, data.getMessage());
+
+ // both lists in the update are null - should not throw an exception
+ PdpUpdate msg3 = new PdpUpdate(update);
+ msg3.setPdpGroup(DIFFERENT);
+ msg3.setPoliciesToBeDeployed(null);
+ msg3.setPoliciesToBeUndeployed(null);
+ assertThatCode(() -> data.reconfigure(msg3)).doesNotThrowAnyException();
+
+ // both lists in the current msg (i.e., msg3) are null - should not throw an exception
+ assertThatCode(() -> data.reconfigure(update)).doesNotThrowAnyException();
}
@Test