### Question:
EurekaServiceInstanceConverter extends DefaultServiceInstanceConverter { @Override protected URI getHealthUrl(ServiceInstance instance) { if (!(instance instanceof EurekaServiceInstance)) { return super.getHealthUrl(instance); } InstanceInfo instanceInfo = ((EurekaServiceInstance) instance).getInstanceInfo(); String healthUrl = instanceInfo.getSecureHealthCheckUrl(); if (StringUtils.isEmpty(healthUrl)) { healthUrl = instanceInfo.getHealthCheckUrl(); } return URI.create(healthUrl); }    }### Answer:
@Test public void convert_secure() { InstanceInfo instanceInfo = mock(InstanceInfo.class); when(instanceInfo.getSecureHealthCheckUrl()).thenReturn(""); when(instanceInfo.getHealthCheckUrl()).thenReturn("http: EurekaServiceInstance service = mock(EurekaServiceInstance.class); when(service.getInstanceInfo()).thenReturn(instanceInfo); when(service.getUri()).thenReturn(URI.create("http: when(service.getServiceId()).thenReturn("test"); when(service.getMetadata()).thenReturn(singletonMap("management.context-path", "/mgmt")); Registration registration = new EurekaServiceInstanceConverter().convert(service); assertThat(registration.getName()).isEqualTo("test"); assertThat(registration.getServiceUrl()).isEqualTo("http: assertThat(registration.getManagementUrl()).isEqualTo("http: assertThat(registration.getHealthUrl()).isEqualTo("http: }
@Test public void convert_secure_healthUrl() { InstanceInfo instanceInfo = mock(InstanceInfo.class); when(instanceInfo.getSecureHealthCheckUrl()).thenReturn("https: EurekaServiceInstance service = mock(EurekaServiceInstance.class); when(service.getInstanceInfo()).thenReturn(instanceInfo); when(service.getUri()).thenReturn(URI.create("http: when(service.getServiceId()).thenReturn("test"); Registration registration = new EurekaServiceInstanceConverter().convert(service); assertThat(registration.getHealthUrl()).isEqualTo("https: }