### Question:
WatchdogDistribution { public void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus) throws Exception { logger.debug("Entered executePatchAAI method with distrubutionId: {} and distributionStatus: ", distributionId, distributionStatus); try { WatchdogServiceModVerIdLookup lookup = watchdogModVerIdLookupRepository.findOneByDistributionId(distributionId); String serviceModelVersionId = ""; if (lookup != null) { serviceModelVersionId = lookup.getServiceModelVersionId(); } logger.debug("Executed RequestDB getWatchdogServiceModVerIdLookup with distributionId: {} " + "and serviceModelVersionId: {}", distributionId, serviceModelVersionId); logger.debug("ASDC Notification ServiceModelInvariantUUID : {}", serviceModelInvariantUUID); if (serviceModelInvariantUUID == null || "".equals(serviceModelVersionId)) { String error = "No Service found with serviceModelInvariantUUID: " + serviceModelInvariantUUID; logger.debug(error); throw new Exception(error); } AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation() .model(serviceModelInvariantUUID).modelVer(serviceModelVersionId)); aaiUri.depth(Depth.ZERO); logger.debug("Target A&AI Resource URI: {}", aaiUri.build().toString()); Map<String, String> payload = new HashMap<>(); payload.put("distribution-status", distributionStatus); getAaiClient().update(aaiUri, payload); logger.debug("A&AI UPDATE MODEL Version is success!"); } catch (Exception e) { logger.debug("Exception occurred on executePatchAAI : {}", e.getMessage()); logger.error("Exception occurred", e); throw new Exception(e); } }  String getOverallDistributionStatus(String distributionId); void executePatchAAI(String distributionId, String serviceModelInvariantUUID, String distributionStatus); void updateCatalogDBStatus(String serviceModelVersionId, String status); AAIResourcesClient getAaiClient(); void setAaiClient(AAIResourcesClient aaiClient);  }### Answer:
@Test public void executePatchAAITest() throws Exception { Service service = new Service(); service.setModelInvariantUUID("9647dfc4-2083-11e7-93ae-92361f002671"); doReturn(aaiResourceClient).when(watchdogDistributionSpy).getAaiClient(); doNothing().when(aaiResourceClient).update(isA(AAIResourceUri.class), isA(HashMap.class)); watchdogDistribution.executePatchAAI(SUCCESS_TEST, service.getModelInvariantUUID(), DistributionStatus.SUCCESS.toString()); verify(aaiResourceClient, times(1)).update(any(AAIResourceUri.class), any(HashMap.class)); }
@Test public void executePatchAAINullDistrubutionIdTest() throws Exception { expectedException.expect(Exception.class); watchdogDistribution.executePatchAAI(null, "", DistributionStatus.SUCCESS.toString()); }
@Test public void executePatchAAINullServiceTest() throws Exception { expectedException.expect(Exception.class); watchdogDistribution.executePatchAAI(NULL_TEST, null, DistributionStatus.SUCCESS.toString()); }