From 6dfa17533498596be0a0f8a23f81caf531544b04 Mon Sep 17 00:00:00 2001 From: Oleksandr Moliavko Date: Thu, 8 Aug 2019 13:13:29 +0300 Subject: Added null checks for getUpdateResInputObj() return value to prevent crash at toString() calls Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko Change-Id: If55fd3b00fe9d2406fe1b2eeda66fa005ce13bc4 --- .../pnf/delegate/CreateAndActivatePnfResourceTest.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bpmn') diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index fc0f51b032..91cfa93a34 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -63,8 +63,9 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() { // given variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY); - if (getUpdateResInputObj("OLT") != null) { - variables.put("resourceInput", getUpdateResInputObj("OLT").toString()); + ResourceInput ri = getUpdateResInputObj("OLT"); + if (ri != null) { + variables.put("resourceInput", ri.toString()); } else { variables.put("resourceInput", null); } @@ -86,7 +87,12 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() { // given variables.put(PNF_CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY); - variables.put("resourceInput", getUpdateResInputObj("OLT").toString()); + ResourceInput ri = getUpdateResInputObj("OLT"); + if (ri != null) { + variables.put("resourceInput", ri.toString()); + } else { + variables.put("resourceInput", null); + } // when ProcessInstance instance = runtimeService.startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); -- cgit 1.2.3-korg