### Question:
BackingAppManagementService { public Mono<BackingApplications> getDeployedBackingApplications(String serviceInstanceId) { return fetchServiceDetailsAndInvoke(serviceInstanceId, this::getDeployedBackingApplications); } BackingAppManagementService(ManagementClient managementClient, AppDeployer appDeployer,
		BrokeredServices brokeredServices, TargetService targetService); Mono<Void> stop(String serviceInstanceId); Mono<Void> stop(String serviceInstanceId, String serviceName, String planName); Mono<Void> start(String serviceInstanceId); Mono<Void> start(String serviceInstanceId, String serviceName, String planName); Mono<Void> restart(String serviceInstanceId); Mono<Void> restart(String serviceInstanceId, String serviceName, String planName); Mono<Void> restage(String serviceInstanceId); Mono<Void> restage(String serviceInstanceId, String serviceName, String planName); Mono<BackingApplications> getDeployedBackingApplications(String serviceInstanceId); Mono<BackingApplications> getDeployedBackingApplications(String serviceInstanceId, String serviceName, String planName); Mono<BackingApplications> getBackingApplicationsForService(String serviceInstanceId, String serviceName,
		String planName);  }### Answer:
@Test @SuppressWarnings("unchecked") void getDeployedBackingApplications() { given(appDeployer.getServiceInstance(any(GetServiceInstanceRequest.class))) .willReturn(Mono.just(GetServiceInstanceResponse.builder() .name("foo-service") .plan("plan1") .service("service1") .build())); given(appDeployer.get(any(GetApplicationRequest.class))) .willReturn(Mono.just(GetApplicationResponse.builder() .name("testApp1") .service("service1") .service("service2") .build()), Mono.just(GetApplicationResponse.builder() .name("testApp2") .service("service3") .build())); given(targetService.addToBackingApplications(eq(backingApps), any(), eq("foo-service-id"))) .willReturn(Mono.just(backingApps)); StepVerifier.create(backingAppManagementService.getDeployedBackingApplications("foo-service-id")) .expectNext(BackingApplications.builder() .backingApplication(BackingApplication.builder() .name("testApp1") .services( ServicesSpec.builder().serviceInstanceName("service1").build(), ServicesSpec.builder().serviceInstanceName("service2").build()) .build()) .backingApplication(BackingApplication.builder() .name("testApp2") .services(ServicesSpec.builder().serviceInstanceName("service3").build()) .build()) .build()) .verifyComplete(); then(targetService).should().addToBackingApplications(eq(backingApps), any(), eq("foo-service-id")); then(appDeployer).should().getServiceInstance(argThat(req -> "foo-service-id".equals(req.getServiceInstanceId()))); then(appDeployer).should().get(argThat(req -> "testApp1".equals(req.getName()))); then(appDeployer).should().get(argThat(req -> "testApp2".equals(req.getName()))); verifyNoInteractions(managementClient); verifyNoMoreInteractions(appDeployer, targetService, managementClient); }