### Question:
SDNOHealthCheckTasks { public void sdnoHealthCheck(BuildingBlockExecution execution) { boolean response = false; try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); RequestContext requestContext = gBBInput.getRequestContext(); GenericVnf vnf = null; Map<ResourceKey, String> lookupMap = execution.getLookupMap(); for (Map.Entry<ResourceKey, String> entry : lookupMap.entrySet()) { if (entry.getKey().equals(ResourceKey.GENERIC_VNF_ID)) { vnf = extractPojosForBB.extractByKey(execution, entry.getKey()); } } response = sdnoHealthCheckResources.healthCheck(vnf, requestContext); } catch (Exception ex) { logger.error("Exception occurred", ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex.getMessage()); } if (!response) { logger.error("SDNO Health Check failed"); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SDNO Health Check failed"); } }  void sdnoHealthCheck(BuildingBlockExecution execution);  }### Answer:
@Test public void sdnoHealthCheckTest() throws Exception { doReturn(true).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); sdnoHealthCheckTasks.sdnoHealthCheck(execution); verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); }
@Test public void sdnoHealthCheckNoResponseTest() throws Exception { doReturn(false).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); try { sdnoHealthCheckTasks.sdnoHealthCheck(execution); } catch (Exception e) { verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); } }
@Test public void sdnoHealthCheckExceptionTest() throws Exception { doThrow(new Exception("Unknown Error")).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); doThrow(new BpmnError("Unknown Error")).when(exceptionUtil) .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); try { sdnoHealthCheckTasks.sdnoHealthCheck(execution); } catch (Exception e) { verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); } }