diff --git a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java index 3bc02e54..65a81020 100644 --- a/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java +++ b/spring-cloud-loadbalancer/src/main/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSupplierBuilder.java @@ -48,6 +48,7 @@ import org.springframework.web.util.UriComponentsBuilder; * @author Spencer Gibb * @author Olga Maciaszek-Sharma * @author Zhiguo Chen + * @author Sabyasachi Bhattacharya */ public final class ServiceInstanceListSupplierBuilder { @@ -311,7 +312,7 @@ public final class ServiceInstanceListSupplierBuilder { })); } - private String getUri(ServiceInstance serviceInstance, String healthCheckPath) { + static String getUri(ServiceInstance serviceInstance, String healthCheckPath) { if (StringUtils.hasText(healthCheckPath)) { String path = healthCheckPath.startsWith("/") ? healthCheckPath : "/" + healthCheckPath; return serviceInstance.getUri().toString() + path; diff --git a/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java b/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java index de12ec19..ffc54acc 100644 --- a/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java +++ b/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/HealthCheckServiceInstanceListSupplierTests.java @@ -62,6 +62,7 @@ import static org.springframework.cloud.loadbalancer.core.ServiceInstanceListSup * @author Olga Maciaszek-Sharma * @author Roman Matiushchenko * @author Roman Chigvintsev + * @author Sabyasachi Bhattacharya */ @ExtendWith(SpringExtension.class) @SpringBootTest(classes = HealthCheckServiceInstanceListSupplierTests.TestApplication.class, diff --git a/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSuppliersTestUtils.java b/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSuppliersTestUtils.java index 7f990eed..4aa9582c 100644 --- a/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSuppliersTestUtils.java +++ b/spring-cloud-loadbalancer/src/test/java/org/springframework/cloud/loadbalancer/core/ServiceInstanceListSuppliersTestUtils.java @@ -23,15 +23,17 @@ import reactor.core.publisher.Mono; import org.springframework.cloud.client.ServiceInstance; import org.springframework.http.HttpStatus; -import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.web.util.UriComponentsBuilder; +import static org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplierBuilder.getUri; + /** * A utility class for {@link ServiceInstanceListSupplier} tests. * * @author Olga Maciaszek-Sharma + * @author Sabyasachi Bhattacharya * @since 3.0.0 */ final class ServiceInstanceListSuppliersTestUtils { @@ -59,12 +61,4 @@ final class ServiceInstanceListSuppliersTestUtils { }); } - private static String getUri(ServiceInstance serviceInstance, String healthCheckPath) { - if (StringUtils.hasText(healthCheckPath)) { - String path = healthCheckPath.startsWith("/") ? healthCheckPath : "/" + healthCheckPath; - return serviceInstance.getUri().toString() + path; - } - return serviceInstance.getUri().toString(); - } - }