ServiceInstanceBindingEventService implements ServiceInstanceBindingService { @Override public Mono<GetLastServiceBindingOperationResponse> getLastOperation( GetLastServiceBindingOperationRequest request) { return flows.getAsyncOperationBindingRegistry().getInitializationFlows(request) .then(service.getLastOperation(request)) .onErrorResume(e -> flows.getAsyncOperationBindingRegistry().getErrorFlows(request, e) .then(Mono.error(e))) .flatMap(response -> flows.getAsyncOperationBindingRegistry().getCompletionFlows(request, response) .then(Mono.just(response))); } ServiceInstanceBindingEventService(ServiceInstanceBindingService service, EventFlowRegistries flows); @Override Mono<CreateServiceInstanceBindingResponse> createServiceInstanceBinding(
			CreateServiceInstanceBindingRequest request); @Override Mono<GetServiceInstanceBindingResponse> getServiceInstanceBinding(GetServiceInstanceBindingRequest request); @Override Mono<GetLastServiceBindingOperationResponse> getLastOperation(
			GetLastServiceBindingOperationRequest request); @Override Mono<DeleteServiceInstanceBindingResponse> deleteServiceInstanceBinding(
			DeleteServiceInstanceBindingRequest request);  }
@Test void getLastOperationSucceeds() { prepareLastOperationEventFlows(); StepVerifier .create(serviceInstanceBindingEventService.getLastOperation( GetLastServiceBindingOperationRequest.builder() .bindingId("service-instance-id") .serviceInstanceId("service-binding-id") .build())) .expectNext(GetLastServiceBindingOperationResponse.builder().build()) .verifyComplete(); assertThat(this.results.getBeforeLastOperation()).isEqualTo("before service-instance-id"); assertThat(this.results.getAfterLastOperation()).isEqualTo("after service-instance-id"); assertThat(this.results.getErrorLastOperation()).isNullOrEmpty(); }
@Test void getLastOperationFails() { prepareLastOperationEventFlows(); StepVerifier .create(serviceInstanceBindingEventService.getLastOperation( GetLastServiceBindingOperationRequest.builder() .bindingId("service-instance-id") .build())) .expectError() .verify(); assertThat(this.results.getBeforeLastOperation()).isEqualTo("before service-instance-id"); assertThat(this.results.getAfterLastOperation()).isNullOrEmpty(); assertThat(this.results.getErrorLastOperation()).isEqualTo("error service-instance-id"); }