### Question:
ApimlRetryableClient extends RetryableRibbonLoadBalancingHttpClient { @Override public ServiceInstance choose(String serviceId) { super.choose(serviceId); return new EurekaDiscoveryClient.EurekaServiceInstance( RequestContextUtils.getInstanceInfo().orElseThrow(() -> new RequestContextNotPreparedException("request context not prepared"))); } ApimlRetryableClient(CloseableHttpClient delegate, IClientConfig config, ServerIntrospector serverIntrospector, LoadBalancedRetryFactory loadBalancedRetryFactory); @Override ServiceInstance choose(String serviceId);  }### Answer:
@Test void givenServiceId_whenChoose_thenProducesServiceInstance() { ApimlRetryableClient client = new ApimlRetryableClient( httpClient, config, introspector, retryFactory ); doReturn(new Server("aaa", 22)).when(lb).chooseServer(any()); RequestContextUtils.setInstanceInfo( InstanceInfo.Builder.newBuilder().setAppName("Sonya").build() ); client.setLoadBalancer(lb); ServiceInstance instance = client.choose("service1"); assertThat(instance, instanceOf(EurekaDiscoveryClient.EurekaServiceInstance.class)); }