@Override
	public Flux<ServiceInstance> getInstances(String serviceId) {

		return Mono.justOrEmpty(serviceId).flatMapMany(loadInstancesFromPolaris())
				.subscribeOn(Schedulers.boundedElastic());
	}
@Test
	public void testGetInstances() throws PolarisException {

		when(serviceDiscovery.getInstances(anyString())).thenAnswer(invocation -> {
			String serviceName = invocation.getArgument(0);
			if (SERVICE_PROVIDER.equalsIgnoreCase(serviceName)) {
				return singletonList(mock(ServiceInstance.class));
			}
			else {
				throw new PolarisException(ErrorCode.UNKNOWN_SERVER_ERROR);
			}
		});

		// Normal
		Flux<ServiceInstance> instances = this.client.getInstances(SERVICE_PROVIDER);
		StepVerifier.create(instances).expectNextCount(1).expectComplete().verify();

		// PolarisException
		instances = this.client.getInstances(SERVICE_PROVIDER + 1);
		StepVerifier.create(instances).expectNextCount(0).expectComplete().verify();
	}