### Question:
MultiStageSkipListener implements FlowManipulator, PostCompletionRequestsDbListener { @Override public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB, BuildingBlockExecution execution) { String vfModuleId = currentBB.getResourceId(); String vnfId = currentBB.getWorkflowResourceIds().getVnfId(); org.onap.aai.domain.yang.VfModule vfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId); if (vfModule == null) { org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); if (vnf != null) { VnfResourceCustomization vnfCust = catalogDbClient .getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId()); if (vnfCust != null && vnfCust.getMultiStageDesign() != null && vnfCust.getMultiStageDesign().equalsIgnoreCase("true")) { flowsToExecute.retainAll(Collections.singletonList(currentBB)); execution.setVariable(G_MULTI_STAGE_DESIGN, Boolean.valueOf(vnfCust.getMultiStageDesign())); } } } }  @Override boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution); @Override boolean shouldRunFor(BuildingBlockExecution execution); @Override void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
            BuildingBlockExecution execution); @Override void run(InfraActiveRequests request, BuildingBlockExecution execution);  }### Answer:
@Test public void testProcessMultiStageSkip() { String vfModuleId = "vfModuleId"; String vnfId = "vnfId"; List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setServiceInstanceId("serviceInstanceId"); workflowResourceIds.setVnfId(vnfId); BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setResourceId(vfModuleId).setBuildingBlock(bb) .setWorkflowResourceIds(workflowResourceIds); flowsToExecute.add(ebb); flowsToExecute.add(new ExecuteBuildingBlock()); flowsToExecute.add(new ExecuteBuildingBlock()); BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake()); org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule(); vfModule.setVfModuleId(vfModuleId); org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf(); vnf.setModelCustomizationId("modelCustomizationUUID"); VnfResourceCustomization vnfCust = new VnfResourceCustomization(); vnfCust.setModelCustomizationUUID("modelCustomizationUUID"); vnfCust.setMultiStageDesign("true"); when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId())) .thenReturn(vnfCust); when(bbInputSetupUtils.getAAIVfModule(eq(vnfId), eq(vfModuleId))).thenReturn(null); when(bbInputSetupUtils.getAAIGenericVnf(eq(vnfId))).thenReturn(vnf); multiStageSkipListener.run(flowsToExecute, flowsToExecute.get(0), execution); assertEquals("Flows should only have Assign", flowsToExecute.size(), 1); assertEquals("Flows should only have Assign", flowsToExecute.get(0).getBuildingBlock().getBpmnFlowName(), "AssignVfModuleBB"); }
@Test public void postCompletionRequestsDbListenerTest() { InfraActiveRequests request = new InfraActiveRequests(); BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake()); multiStageSkipListener.run(request, execution); assertEquals("Successfully completed Assign Building Block only due to multi-stage-design VNF", request.getFlowStatus()); }