### Question:
EtsiVnfDeleteTask { public void invokeVnfmAdapter(final BuildingBlockExecution execution) { try { LOGGER.debug("Executing invokeVnfmAdapter ..."); final GenericVnf vnf = extractPojosForBB.extractByKey(execution, GENERIC_VNF_ID); final Optional<DeleteVnfResponse> response = vnfmAdapterServiceProvider.invokeDeleteRequest(vnf.getVnfId()); if (!response.isPresent()) { final String errorMessage = "Unexpected error while processing delete request"; LOGGER.error(errorMessage); exceptionUtil.buildAndThrowWorkflowException(execution, 1211, errorMessage); } final DeleteVnfResponse vnfResponse = response.get(); LOGGER.debug("Vnf delete response: {}", vnfResponse); execution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, vnfResponse); LOGGER.debug("Finished executing invokeVnfmAdapter ..."); } catch (final Exception exception) { LOGGER.error("Unable to invoke delete request", exception); exceptionUtil.buildAndThrowWorkflowException(execution, 1212, exception); } } @Autowired  EtsiVnfDeleteTask(final ExceptionBuilder exceptionUtil, final ExtractPojosForBB extractPojosForBB,
            final VnfmAdapterServiceProvider vnfmAdapterServiceProvider); void invokeVnfmAdapter(final BuildingBlockExecution execution);  }### Answer:
@Test public void testInvokeVnfmAdapter() throws Exception { final EtsiVnfDeleteTask objUnderTest = getEtsiVnfDeleteTask(); when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf()); when(mockedVnfmAdapterServiceProvider.invokeDeleteRequest(eq(VNF_ID))).thenReturn(getDeleteVnfResponse()); objUnderTest.invokeVnfmAdapter(stubbedxecution); assertNotNull(stubbedxecution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME)); }
@Test public void testInvokeVnfmAdapterException() throws Exception { final EtsiVnfDeleteTask objUnderTest = getEtsiVnfDeleteTask(); when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(getGenericVnf()); when(mockedVnfmAdapterServiceProvider.invokeDeleteRequest(eq(VNF_ID))).thenReturn(Optional.absent()); objUnderTest.invokeVnfmAdapter(stubbedxecution); assertNull(stubbedxecution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME)); verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1212), any(Exception.class)); }