### Question:
AppDeploymentCreateServiceInstanceWorkflow extends AppDeploymentInstanceWorkflow implements CreateServiceInstanceWorkflow { @Override public Mono<Void> create(CreateServiceInstanceRequest request, CreateServiceInstanceResponse response) { return createBackingServices(request) .thenMany(deployBackingApplications(request)) .then(); } AppDeploymentCreateServiceInstanceWorkflow(BrokeredServices brokeredServices,
		BackingAppDeploymentService deploymentService,
		BackingServicesProvisionService backingServicesProvisionService,
		BackingApplicationsParametersTransformationService appsParametersTransformationService,
		BackingServicesParametersTransformationService servicesParametersTransformationService,
		CredentialProviderService credentialProviderService,
		TargetService targetService); @Override Mono<Void> create(CreateServiceInstanceRequest request, CreateServiceInstanceResponse response); @Override Mono<Boolean> accept(CreateServiceInstanceRequest request); @Override Mono<CreateServiceInstanceResponseBuilder> buildResponse(CreateServiceInstanceRequest request,
		CreateServiceInstanceResponseBuilder responseBuilder);  }### Answer:
@Test @SuppressWarnings({"unchecked", "UnassignedFluxMonoInstance"}) void createServiceInstanceSucceeds() { CreateServiceInstanceRequest request = buildRequest("service1", "plan1"); CreateServiceInstanceResponse response = CreateServiceInstanceResponse.builder().build(); setupMocks(request); StepVerifier .create(createServiceInstanceWorkflow.create(request, response)) .expectNext() .expectNext() .verifyComplete(); verify(appDeploymentService).deploy(backingApps, request.getServiceInstanceId()); verify(servicesProvisionService).createServiceInstance(backingServices); final String expectedServiceId = "service-instance-id"; verify(targetService).addToBackingServices(backingServices, targetSpec, expectedServiceId); verify(targetService).addToBackingApplications(backingApps, targetSpec, expectedServiceId); verifyNoMoreInteractionsWithServices(); }
@Test @SuppressWarnings("UnassignedFluxMonoInstance") void createServiceInstanceWithParametersSucceeds() { Map<String, Object> parameters = singletonMap("ENV_VAR_1", "value from parameters"); CreateServiceInstanceRequest request = buildRequest("service1", "plan1", parameters); CreateServiceInstanceResponse response = CreateServiceInstanceResponse.builder().build(); setupMocks(request); StepVerifier .create(createServiceInstanceWorkflow.create(request, response)) .expectNext() .expectNext() .verifyComplete(); verify(appDeploymentService).deploy(backingApps, request.getServiceInstanceId()); verify(servicesProvisionService).createServiceInstance(backingServices); verify(appsParametersTransformationService) .transformParameters(backingApps, parameters); verify(servicesParametersTransformationService) .transformParameters(backingServices, parameters); verifyNoMoreInteractionsWithServices(); }
@Test void createServiceInstanceWithNoAppsDoesNothing() { CreateServiceInstanceRequest request = buildRequest("unsupported-service", "plan1"); CreateServiceInstanceResponse response = CreateServiceInstanceResponse.builder().build(); StepVerifier .create(createServiceInstanceWorkflow.create(request, response)) .verifyComplete(); verifyNoMoreInteractionsWithServices(); }