From ae9a2bd01ae94f303d390fdb0673dba71b07fcb0 Mon Sep 17 00:00:00 2001 From: "Bhatt, Prema" Date: Tue, 17 Sep 2019 08:08:12 -0400 Subject: Exception string in checkRelationshipRelatedTo Exception string in checkRelationshipRelatedTo not being returned properly. Added a new exception - UnassignNetworkException. Added a new unit test to test the exception case as per review comment. Updated UnassignNetworkBBTest.java file to fix the formatting errors. Updated unit test , removed setVariable, it wasn't needed to do as it was performed in the actual method call. Updated pom.xmp file to fix the formatting errors. Updated pom.xml file to fix the formatting errors. Issue-ID: SO-2346 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I617dfbcb07d6080598a3ef8138aad5c7008dcee2 --- .../flowspecific/tasks/UnassignNetworkBBTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/test') diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java index bacc57758b..ed55c56231 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java @@ -40,9 +40,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; -import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.springframework.beans.factory.annotation.Autowired; public class UnassignNetworkBBTest extends BaseTaskTest { @@ -83,6 +81,15 @@ public class UnassignNetworkBBTest extends BaseTaskTest { assertThat(execution.getVariable("ErrorUnassignNetworkBB"), notNullValue()); } + @Test + public void checkRelationshipRelatedToUnassignNetworkExceptionTest() throws Exception { + String msg = "Cannot perform Unassign Network. Network is still related to vf-module"; + expectedException.expect(BpmnError.class); + doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module")); + unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module"); + assertEquals(execution.getVariable("ErrorUnassignNetworkBB"), msg); + } + @Test public void getCloudSdncRegion25Test() throws Exception { CloudRegion cloudRegion = setCloudRegion(); -- cgit 1.2.3-korg