### Question:
ASDCStatusCallBack implements IStatusCallback { @Override public void activateCallback(IStatusData iStatus) { String event = "Receive a callback componentStatus in ASDC, for componentName: " + iStatus.getComponentName() + " and status of " + iStatus.getStatus() + " distributionID of " + iStatus.getDistributionID(); try { if (iStatus.getStatus() == null) { logger.info("Missing status on Status Object. "); return; } if (!iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) && !iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) { logger.info("Status is not 'Component Done OK' or 'Component Done Error'"); return; } WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findById(iStatus.getDistributionID()).orElseGet(() -> null); if (watchdogDistributionStatus == null) { watchdogDistributionStatus = new WatchdogDistributionStatus(); watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID()); watchdogDistributionStatusRepository.save(watchdogDistributionStatus); } logger.debug(event); toscaInstaller.installTheComponentStatus(iStatus); } catch (ArtifactInstallerException e) { logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e); logger.debug("Error in ASDCStatusCallback {}", e.getMessage()); } }  @Override void activateCallback(IStatusData iStatus);  }### Answer:
@Test public void activateCallbackTest() throws Exception { JsonStatusData statusData = new JsonStatusData(); doNothing().when(toscaInstaller).installTheComponentStatus(isA(JsonStatusData.class)); statusCallback.activateCallback(statusData); verify(toscaInstaller, times(1)).installTheComponentStatus(statusData); }
@Test public void activateCallbackDoneErrorStatusTest() throws Exception { IStatusData statusData = mock(IStatusData.class); doReturn("distributionId").when(statusData).getDistributionID(); doReturn("componentName").when(statusData).getComponentName(); doReturn(DistributionStatusEnum.COMPONENT_DONE_ERROR).when(statusData).getStatus(); doNothing().when(toscaInstaller).installTheComponentStatus(isA(IStatusData.class)); statusCallback.activateCallback(statusData); verify(toscaInstaller, times(1)).installTheComponentStatus(statusData); }
@Test public void activateCallbackExceptionTest() throws Exception { IStatusData statusData = mock(IStatusData.class); doReturn("distributionId").when(statusData).getDistributionID(); doReturn("componentName").when(statusData).getComponentName(); doReturn(DistributionStatusEnum.COMPONENT_DONE_OK).when(statusData).getStatus(); doThrow(ArtifactInstallerException.class).when(toscaInstaller) .installTheComponentStatus(isA(IStatusData.class)); statusCallback.activateCallback(statusData); }