### Question:
DeployerClient { public Mono<String> updateServiceInstance(BackingService backingService) { return appDeployer .updateServiceInstance( UpdateServiceInstanceRequest .builder() .serviceInstanceName(backingService.getServiceInstanceName()) .parameters(backingService.getParameters()) .properties(backingService.getProperties()) .rebindOnUpdate(backingService.isRebindOnUpdate()) .build()) .doOnRequest(l -> { LOG.info("Updating backing service {}", backingService.getName()); LOG.debug(BACKINGSERVICE_LOG_TEMPLATE, backingService); }) .doOnSuccess(response -> { LOG.info("Success updating backing service {}", backingService.getName()); LOG.debug("response={}, backingService={}", response, backingService); }) .doOnError(e -> { LOG.error(String.format("Error updating backing service. backingServiceName=%s, error=%s", backingService.getName(), e.getMessage()), e); LOG.debug(BACKINGSERVICE_LOG_TEMPLATE, backingService); }) .map(UpdateServiceInstanceResponse::getName); } DeployerClient(AppDeployer appDeployer); Mono<String> deploy(BackingApplication backingApplication, String serviceInstanceId); Mono<String> update(BackingApplication backingApplication, String serviceInstanceId); Mono<String> undeploy(BackingApplication backingApplication); Mono<String> createServiceInstance(BackingService backingService); Mono<String> updateServiceInstance(BackingService backingService); Mono<String> deleteServiceInstance(BackingService backingService);  }### Answer:
@Test void shouldUpdateServiceInstance() { given(appDeployer.updateServiceInstance(any())) .willReturn(Mono.just(UpdateServiceInstanceResponse.builder() .name(SERVICE_INSTANCE_NAME) .build())); BackingService service = BackingService.builder() .serviceInstanceName(SERVICE_INSTANCE_NAME) .build(); StepVerifier.create(deployerClient.updateServiceInstance(service)) .expectNext(SERVICE_INSTANCE_NAME) .verifyComplete(); then(appDeployer).should().updateServiceInstance(argThat(request -> SERVICE_INSTANCE_NAME.equals(request.getServiceInstanceName()))); }
@Test void shouldReturnErrorWhenUpdatingServiceInstanceThatDoesNotExist() { given(appDeployer.updateServiceInstance(any())) .willReturn(Mono.error(new IllegalStateException("service instance does not exist"))); BackingService service = BackingService.builder() .serviceInstanceName(SERVICE_INSTANCE_NAME) .build(); StepVerifier.create(deployerClient.updateServiceInstance(service)) .expectErrorMessage("service instance does not exist") .verify(); then(appDeployer).should().updateServiceInstance(argThat(request -> SERVICE_INSTANCE_NAME.equals(request.getServiceInstanceName()))); }