From 81ee8de8a281aa1d8618cf42873aca5ee08a196c Mon Sep 17 00:00:00 2001 From: maniotie <49526904+maniotie@users.noreply.github.com> Date: Mon, 26 Jul 2021 09:21:46 -0400 Subject: [PATCH] Updated class and method visibility for junit jupiter tests - issue 4011 (#4017) --- .../cloud/netflix/eureka/BaseCertTest.java | 18 ++-- .../ConditionalOnRefreshScopeTests.java | 8 +- ...lientAutoConfigurationRandomPortTests.java | 4 +- .../EurekaClientAutoConfigurationTests.java | 96 +++++++++---------- .../eureka/EurekaClientConfigBeanTests.java | 16 ++-- .../eureka/EurekaHealthCheckHandlerTests.java | 22 ++--- .../eureka/EurekaInstanceConfigBeanTests.java | 44 ++++----- .../eureka/EurekaServiceInstanceTests.java | 4 +- .../eureka/InstanceInfoFactoryTests.java | 8 +- .../eureka/config/ConfigRefreshTests.java | 4 +- ...entConfigServerAutoConfigurationTests.java | 8 +- ...nfigServerBootstrapConfigurationTests.java | 10 +- ...onfigurationWebClientIntegrationTests.java | 4 +- ...rBootstrapConfigurationWebClientTests.java | 6 +- .../EurekaConfigServerBootstrapperTests.java | 6 +- ...ptionalArgsConfigurationNoWebfluxTest.java | 4 +- ...pClientsOptionalArgsConfigurationTest.java | 8 +- .../JerseyOptionalArgsConfigurationTest.java | 4 +- .../healthcheck/EurekaHealthCheckTests.java | 4 +- .../http/AbstractEurekaHttpClientTest.java | 28 +++--- .../RestTemplateEurekaHttpClientTest.java | 4 +- ...tTemplateTransportClientFactoriesTest.java | 4 +- ...estTemplateTransportClientFactoryTest.java | 12 +-- .../http/WebClientEurekaHttpClientTest.java | 4 +- ...WebClientTransportClientFactoriesTest.java | 4 +- .../WebClientTransportClientFactoryTest.java | 12 +-- ...aLoadBalancerClientConfigurationTests.java | 6 +- ...DefaultManagementMetadataProviderTest.java | 26 ++--- ...tiveDiscoveryClientConfigurationTests.java | 12 +-- .../EurekaReactiveDiscoveryClientTests.java | 14 +-- .../eureka/sample/ApplicationTests.java | 4 +- .../EurekaServiceRegistryTests.java | 8 +- .../eureka/support/ZoneUtilsTests.java | 4 +- .../server/ApplicationContextTests.java | 12 +-- .../ApplicationDashboardDisabledTests.java | 6 +- .../server/ApplicationDashboardPathTests.java | 10 +- .../server/ApplicationServletPathTests.java | 12 +-- .../eureka/server/ApplicationTests.java | 12 +-- .../server/EurekaControllerReplicasTests.java | 12 +-- .../eureka/server/EurekaControllerTests.java | 8 +- .../server/EurekaCustomPeerNodesTests.java | 4 +- ...ekaServerInitializerConfigurationTest.java | 6 +- .../eureka/server/InstanceRegistryTests.java | 12 +-- .../RefreshablePeerEurekaNodesTests.java | 22 ++--- ...PeerEurekaNodesWithCustomFiltersTests.java | 4 +- 45 files changed, 270 insertions(+), 270 deletions(-) diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java index 32874fe47..784aa1ea7 100644 --- a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java @@ -33,7 +33,7 @@ import org.springframework.beans.factory.BeanCreationException; import static org.assertj.core.api.Assertions.assertThat; -public abstract class BaseCertTest { +abstract class BaseCertTest { private static final Log log = LogFactory.getLog(BaseCertTest.class); @@ -96,7 +96,7 @@ public abstract class BaseCertTest { } @BeforeAll - public static void createCertificates() throws Exception { + static void createCertificates() throws Exception { KeyTool tool = new KeyTool(); KeyAndCert ca = tool.createCA("MyCA"); @@ -115,7 +115,7 @@ public abstract class BaseCertTest { } @AfterAll - public static void afterClass() { + static void afterClass() { log.info("Tests finished!"); } @@ -126,11 +126,11 @@ public abstract class BaseCertTest { * purpose explicitly. */ @Test - public void clientCertCanWork() { + void clientCertCanWork() { } @Test - public void noCertCannotWork() { + void noCertCannotWork() { try (EurekaClientRunner client = createEurekaClient()) { client.disableTls(); client.start(); @@ -139,7 +139,7 @@ public abstract class BaseCertTest { } @Test - public void wrongCertCannotWork() { + void wrongCertCannotWork() { try (EurekaClientRunner client = createEurekaClient()) { enableTlsClient(client); client.setKeyStore(wrongClientCert); @@ -149,7 +149,7 @@ public abstract class BaseCertTest { } @Test - public void wrongPasswordCauseFailure() { + void wrongPasswordCauseFailure() { EurekaClientRunner client = createEurekaClient(); enableTlsClient(client); client.setKeyStore(clientCert, WRONG_PASSWORD, WRONG_PASSWORD); @@ -159,7 +159,7 @@ public abstract class BaseCertTest { } @Test - public void nonExistKeyStoreCauseFailure() { + void nonExistKeyStoreCauseFailure() { EurekaClientRunner client = createEurekaClient(); enableTlsClient(client); client.setKeyStore(new File("nonExistFile")); @@ -169,7 +169,7 @@ public abstract class BaseCertTest { } @Test - public void wrongTrustStoreCannotWork() { + void wrongTrustStoreCannotWork() { try (EurekaClientRunner client = createEurekaClient()) { enableTlsClient(client); client.setTrustStore(wrongCaCert); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java index d5c3f99cd..2b2cfc3b0 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java @@ -32,10 +32,10 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer * @author Biju Kunjummen */ -public class ConditionalOnRefreshScopeTests { +class ConditionalOnRefreshScopeTests { @Test - public void refreshScopeIncluded() { + void refreshScopeIncluded() { new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class)) .withUserConfiguration(Beans.class).run(c -> { assertThat(c).hasSingleBean(org.springframework.cloud.context.scope.refresh.RefreshScope.class); @@ -44,7 +44,7 @@ public class ConditionalOnRefreshScopeTests { } @Test - public void refreshScopeIncludedAndPropertyDisabled() { + void refreshScopeIncludedAndPropertyDisabled() { new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class)) .withPropertyValues("eureka.client.refresh.enable=false").withUserConfiguration(Beans.class).run(c -> { assertThat(c).hasSingleBean(org.springframework.cloud.context.scope.refresh.RefreshScope.class); @@ -54,7 +54,7 @@ public class ConditionalOnRefreshScopeTests { } @Test - public void refreshScopeNotIncluded() { + void refreshScopeNotIncluded() { new ApplicationContextRunner().withUserConfiguration(Beans.class).run(c -> { assertThat(c).doesNotHaveBean("foo"); assertThat(c.getBean("bar")).isEqualTo("bar"); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationRandomPortTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationRandomPortTests.java index 4be7a020c..a8dddfdf2 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationRandomPortTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationRandomPortTests.java @@ -32,13 +32,13 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Spencer Gibb */ @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -public class EurekaClientAutoConfigurationRandomPortTests { +class EurekaClientAutoConfigurationRandomPortTests { @Autowired private ApplicationInfoManager infoManager; @Test - public void instanceInfoPortShouldNotBeZero() { + void instanceInfoPortShouldNotBeZero() { InstanceInfo info = infoManager.getInfo(); assertThat(info.getPort()).isGreaterThan(0); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java index 2633dbeb3..5a45a4695 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java @@ -72,12 +72,12 @@ import static org.assertj.core.api.AssertionsForClassTypes.fail; * @author Olga Maciaszek-Sharma * @author Tim Ysewyn */ -public class EurekaClientAutoConfigurationTests { +class EurekaClientAutoConfigurationTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @AfterEach - public void after() { + void after() { if (this.context != null && this.context.isActive()) { this.context.close(); } @@ -95,7 +95,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void shouldSetManagementPortInMetadataMapIfEqualToServerPort() throws Exception { + void shouldSetManagementPortInMetadataMapIfEqualToServerPort() throws Exception { TestPropertyValues.of("server.port=8989").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -105,7 +105,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void shouldNotSetManagementAndJmxPortsInMetadataMap() throws Exception { + void shouldNotSetManagementAndJmxPortsInMetadataMap() throws Exception { TestPropertyValues.of("server.port=8989", "management.server.port=0").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -116,7 +116,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void shouldSetManagementAndJmxPortsInMetadataMap() throws Exception { + void shouldSetManagementAndJmxPortsInMetadataMap() throws Exception { TestPropertyValues.of("management.server.port=9999", "com.sun.management.jmxremote.port=6789") .applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -127,7 +127,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void shouldNotResetManagementAndJmxPortsInMetadataMap() throws Exception { + void shouldNotResetManagementAndJmxPortsInMetadataMap() throws Exception { TestPropertyValues.of("management.server.port=9999", "eureka.instance.metadata-map.jmx.port=9898", "eureka.instance.metadata-map.management.port=7878").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -138,28 +138,28 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void nonSecurePortPeriods() { + void nonSecurePortPeriods() { testNonSecurePort("server.port"); } @Test - public void nonSecurePortUnderscores() { + void nonSecurePortUnderscores() { testNonSecurePortSystemProp("SERVER_PORT"); } @Test - public void nonSecurePort() { + void nonSecurePort() { testNonSecurePortSystemProp("PORT"); assertThat(this.context.getBeanDefinition("eurekaClient").getFactoryMethodName()).isEqualTo("eurekaClient"); } @Test - public void securePortPeriods() { + void securePortPeriods() { testSecurePort("server.port"); } @Test - public void securePortUnderscores() { + void securePortUnderscores() { TestPropertyValues.of("eureka.instance.secure-port-enabled=true").applyTo(this.context); addSystemEnvironment(this.context.getEnvironment(), "SERVER_PORT:8443"); setupContext(); @@ -167,13 +167,13 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void securePort() { + void securePort() { testSecurePort("PORT"); assertThat(this.context.getBeanDefinition("eurekaClient").getFactoryMethodName()).isEqualTo("eurekaClient"); } @Test - public void managementPort() { + void managementPort() { TestPropertyValues.of("server.port=8989", "management.server.port=9999").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); EurekaInstanceConfigBean instance = this.context.getBean(EurekaInstanceConfigBean.class); @@ -182,7 +182,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPort() { + void statusPageUrlPathAndManagementPort() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "eureka.instance.statusPageUrlPath=/myStatusPage").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -192,7 +192,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPort() { + void healthCheckUrlPathAndManagementPort() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "eureka.instance.healthCheckUrlPath=/myHealthCheck").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -202,7 +202,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrl_and_healthCheckUrl_do_not_contain_server_context_path() throws Exception { + void statusPageUrl_and_healthCheckUrl_do_not_contain_server_context_path() throws Exception { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "server.contextPath=/service") .applyTo(this.context); @@ -215,7 +215,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrl_and_healthCheckUrl_contain_management_context_path() throws Exception { + void statusPageUrl_and_healthCheckUrl_contain_management_context_path() throws Exception { TestPropertyValues.of("server.port=8989", "management.server.servlet.context-path=/management") .applyTo(this.context); @@ -228,7 +228,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrl_and_healthCheckUrl_contain_management_context_path_random_port() throws Exception { + void statusPageUrl_and_healthCheckUrl_contain_management_context_path_random_port() throws Exception { TestPropertyValues.of("server.port=0", "management.server.servlet.context-path=/management") .applyTo(this.context); @@ -241,7 +241,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPortAndContextPath() { + void statusPageUrlPathAndManagementPortAndContextPath() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "management.server.servlet.context-path=/manage", "eureka.instance.status-page-url-path=/myStatusPage") .applyTo(this.context); @@ -252,7 +252,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPortAndContextPath() { + void healthCheckUrlPathAndManagementPortAndContextPath() { TestPropertyValues .of("server.port=8989", "management.server.port=9999", "management.server.servlet.context-path=/manage", "eureka.instance.health-check-url-path=/myHealthCheck") @@ -264,7 +264,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPortAndContextPathKebobCase() { + void statusPageUrlPathAndManagementPortAndContextPathKebobCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "management.server.servlet.context-path=/manage", "eureka.instance.status-page-url-path=/myStatusPage") .applyTo(this.context); @@ -275,7 +275,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPortAndContextPathKebobCase() { + void healthCheckUrlPathAndManagementPortAndContextPathKebobCase() { TestPropertyValues .of("server.port=8989", "management.server.port=9999", "management.server.servlet.context-path=/manage", "eureka.instance.health-check-url-path=/myHealthCheck") @@ -287,7 +287,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrl_and_healthCheckUrl_contain_management_base_path() throws Exception { + void statusPageUrl_and_healthCheckUrl_contain_management_base_path() throws Exception { TestPropertyValues.of("server.port=8989", "management.server.base-path=/management").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -299,7 +299,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrl_and_healthCheckUrl_contain_management_base_path_random_port() throws Exception { + void statusPageUrl_and_healthCheckUrl_contain_management_base_path_random_port() throws Exception { TestPropertyValues.of("server.port=0", "management.server.base-path=/management").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -311,7 +311,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPortAndBasePath() { + void statusPageUrlPathAndManagementPortAndBasePath() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "management.server.base-path=/manage", "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -321,7 +321,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPortAndBasePath() { + void healthCheckUrlPathAndManagementPortAndBasePath() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "management.server.base-path=/manage", "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -331,7 +331,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPortAndBasePathKebobCase() { + void statusPageUrlPathAndManagementPortAndBasePathKebobCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "management.server.base-path=/manage", "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -341,7 +341,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPortAndBasePathKebobCase() { + void healthCheckUrlPathAndManagementPortAndBasePathKebobCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "management.server.base-path=/manage", "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -351,7 +351,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathWithServerPortAndContextPathKebobCase() { + void healthCheckUrlPathWithServerPortAndContextPathKebobCase() { TestPropertyValues .of("server.port=8989", "server.servlet.context-path=/servletContextPath", "eureka.instance.health-check-url-path=${server.servlet.context-path:}/myHealthCheck") @@ -363,7 +363,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPortKabobCase() { + void statusPageUrlPathAndManagementPortKabobCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -373,7 +373,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlAndPreferIpAddress() { + void statusPageUrlAndPreferIpAddress() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "eureka.instance.hostname=foo", "eureka.instance.prefer-ip-address:true").applyTo(this.context); @@ -387,7 +387,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageAndHealthCheckUrlsShouldSetUserDefinedIpAddress() { + void statusPageAndHealthCheckUrlsShouldSetUserDefinedIpAddress() { TestPropertyValues .of("server.port=8989", "management.server.port=9999", "eureka.instance.hostname=foo", "eureka.instance.ip-address:192.168.13.90", "eureka.instance.prefer-ip-address:true") @@ -403,7 +403,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPortKabobCase() { + void healthCheckUrlPathAndManagementPortKabobCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -413,7 +413,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void statusPageUrlPathAndManagementPortUpperCase() { + void statusPageUrlPathAndManagementPortUpperCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999").applyTo(this.context); addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_STATUS_PAGE_URL_PATH=/myStatusPage"); setupContext(RefreshAutoConfiguration.class); @@ -423,7 +423,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void healthCheckUrlPathAndManagementPortUpperCase() { + void healthCheckUrlPathAndManagementPortUpperCase() { TestPropertyValues.of("server.port=8989", "management.server.port=9999").applyTo(this.context); addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_HEALTH_CHECK_URL_PATH=/myHealthCheck"); setupContext(RefreshAutoConfiguration.class); @@ -433,7 +433,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void hostname() { + void hostname() { TestPropertyValues.of("server.port=8989", "management.server.port=9999", "eureka.instance.hostname=foo") .applyTo(this.context); setupContext(RefreshAutoConfiguration.class); @@ -443,7 +443,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void refreshScopedBeans() { + void refreshScopedBeans() { setupContext(RefreshAutoConfiguration.class); assertThat(this.context.getBeanDefinition("eurekaClient").getBeanClassName()) .startsWith(GenericScope.class.getName() + "$LockedScopedProxyFactoryBean"); @@ -453,7 +453,7 @@ public class EurekaClientAutoConfigurationTests { @SuppressWarnings({ "unchecked", "rawtypes" }) @Test - public void shouldReregisterHealthCheckHandlerAfterRefresh() throws Exception { + void shouldReregisterHealthCheckHandlerAfterRefresh() throws Exception { TestPropertyValues .of("eureka.client.healthcheck.enabled=true", "spring.cloud.config.import-check.enabled=false", "spring.cloud.refresh.additionalPropertySourcesToRetain=test") @@ -486,7 +486,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void shouldCloseDiscoveryClient() throws Exception { + void shouldCloseDiscoveryClient() throws Exception { TestPropertyValues.of("eureka.client.healthcheck.enabled=true").applyTo(this.context); setupContext(RefreshAutoConfiguration.class, AutoServiceRegistrationConfiguration.class); @@ -501,7 +501,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void basicAuth() { + void basicAuth() { TestPropertyValues .of("server.port=8989", "eureka.client.serviceUrl.defaultZone=https://user:foo@example.com:80/eureka") .applyTo(this.context); @@ -511,7 +511,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void testDefaultAppName() throws Exception { + void testDefaultAppName() throws Exception { setupContext(); assertThat(getInstanceConfig().getAppname()).isEqualTo("unknown"); assertThat(getInstanceConfig().getVirtualHostName()).isEqualTo("unknown"); @@ -519,7 +519,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void testAppName() throws Exception { + void testAppName() throws Exception { TestPropertyValues.of("spring.application.name=mytest").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getAppname()).isEqualTo("mytest"); @@ -528,7 +528,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void testAppNameUpper() throws Exception { + void testAppNameUpper() throws Exception { addSystemEnvironment(this.context.getEnvironment(), "SPRING_APPLICATION_NAME=mytestupper"); setupContext(); assertThat(getInstanceConfig().getAppname()).isEqualTo("mytestupper"); @@ -570,7 +570,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void testInstanceNamePreferred() throws Exception { + void testInstanceNamePreferred() throws Exception { addSystemEnvironment(this.context.getEnvironment(), "SPRING_APPLICATION_NAME=mytestspringappname"); TestPropertyValues.of("eureka.instance.appname=mytesteurekaappname").applyTo(this.context); setupContext(); @@ -578,13 +578,13 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void eurekaHealthIndicatorCreated() { + void eurekaHealthIndicatorCreated() { setupContext(); this.context.getBean(EurekaHealthIndicator.class); } @Test - public void eurekaClientClosed() { + void eurekaClientClosed() { setupContext(TestEurekaClientConfiguration.class); if (this.context != null) { CountDownLatch latch = this.context.getBean(CountDownLatch.class); @@ -594,7 +594,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void eurekaConfigNotLoadedWhenDiscoveryClientDisabled() { + void eurekaConfigNotLoadedWhenDiscoveryClientDisabled() { TestPropertyValues.of("spring.cloud.discovery.enabled=false").applyTo(this.context); setupContext(TestConfiguration.class); assertBeanNotPresent(EurekaClientConfigBean.class); @@ -605,7 +605,7 @@ public class EurekaClientAutoConfigurationTests { } @Test - public void shouldNotHaveDiscoveryClientWhenBlockingDiscoveryDisabled() { + void shouldNotHaveDiscoveryClientWhenBlockingDiscoveryDisabled() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(UtilAutoConfiguration.class, DiscoveryClientOptionalArgsConfiguration.class, EurekaClientAutoConfiguration.class, diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java index 8ab3d10d1..c130d0d07 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java @@ -34,19 +34,19 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Dave Syer */ -public class EurekaClientConfigBeanTests { +class EurekaClientConfigBeanTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @AfterEach - public void init() { + void init() { if (this.context != null) { this.context.close(); } } @Test - public void basicBinding() { + void basicBinding() { TestPropertyValues.of("eureka.client.proxyHost=example.com").applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); this.context.refresh(); @@ -54,7 +54,7 @@ public class EurekaClientConfigBeanTests { } @Test - public void serviceUrl() { + void serviceUrl() { TestPropertyValues.of("eureka.client.serviceUrl.defaultZone:https://example.com").applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); this.context.refresh(); @@ -64,7 +64,7 @@ public class EurekaClientConfigBeanTests { } @Test - public void serviceUrlWithCompositePropertySource() { + void serviceUrlWithCompositePropertySource() { CompositePropertySource source = new CompositePropertySource("composite"); this.context.getEnvironment().getPropertySources().addFirst(source); source.addPropertySource(new MapPropertySource("config", Collections.singletonMap( @@ -79,7 +79,7 @@ public class EurekaClientConfigBeanTests { } @Test - public void serviceUrlWithDefault() { + void serviceUrlWithDefault() { TestPropertyValues.of("eureka.client.serviceUrl.defaultZone:https://example.com").applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); this.context.refresh(); @@ -87,7 +87,7 @@ public class EurekaClientConfigBeanTests { } @Test - public void serviceUrlWithCustomZone() { + void serviceUrlWithCustomZone() { TestPropertyValues.of("eureka.client.serviceUrl.customZone:https://custom-example.com").applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); this.context.refresh(); @@ -95,7 +95,7 @@ public class EurekaClientConfigBeanTests { } @Test - public void serviceUrlWithEmptyServiceUrls() { + void serviceUrlWithEmptyServiceUrls() { TestPropertyValues.of("eureka.client.serviceUrl.defaultZone:").applyTo(this.context); this.context.register(PropertyPlaceholderAutoConfiguration.class, TestConfiguration.class); this.context.refresh(); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java index 381eb5c76..284e5e3d5 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java @@ -45,25 +45,25 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Jakub Narloch * @author Nowrin Anwar Joyita */ -public class EurekaHealthCheckHandlerTests { +class EurekaHealthCheckHandlerTests { private EurekaHealthCheckHandler healthCheckHandler; @BeforeEach - public void setUp() { + void setUp() { healthCheckHandler = new EurekaHealthCheckHandler(new SimpleStatusAggregator()); } @Test - public void testNoHealthCheckRegistered() { + void testNoHealthCheckRegistered() { InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); assertThat(status).isEqualTo(InstanceStatus.UNKNOWN); } @Test - public void testAllUp() throws Exception { + void testAllUp() throws Exception { initialize(UpHealthConfiguration.class, ReactiveUpHealthConfiguration.class); InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); @@ -71,7 +71,7 @@ public class EurekaHealthCheckHandlerTests { } @Test - public void testHealthCheckNotReturnedWhenStopped() throws Exception { + void testHealthCheckNotReturnedWhenStopped() throws Exception { initialize(UpHealthConfiguration.class); healthCheckHandler.stop(); @@ -84,7 +84,7 @@ public class EurekaHealthCheckHandlerTests { } @Test - public void testDownWithBlockingIndicators() throws Exception { + void testDownWithBlockingIndicators() throws Exception { initialize(UpHealthConfiguration.class, DownHealthConfiguration.class); InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); @@ -92,7 +92,7 @@ public class EurekaHealthCheckHandlerTests { } @Test - public void testDownWithReactiveIndicators() throws Exception { + void testDownWithReactiveIndicators() throws Exception { initialize(UpHealthConfiguration.class, ReactiveDownHealthConfiguration.class); InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); @@ -100,7 +100,7 @@ public class EurekaHealthCheckHandlerTests { } @Test - public void testDownWhenBlockingIndicatorUpAndReactiveDown() throws Exception { + void testDownWhenBlockingIndicatorUpAndReactiveDown() throws Exception { initialize(ReactiveUpHealthConfiguration.class, DownHealthConfiguration.class); InstanceStatus status = this.healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); @@ -108,7 +108,7 @@ public class EurekaHealthCheckHandlerTests { } @Test - public void testDownWhenBlockingIndicatorDownAndReactiveUp() throws Exception { + void testDownWhenBlockingIndicatorDownAndReactiveUp() throws Exception { initialize(ReactiveUpHealthConfiguration.class, ReactiveDownHealthConfiguration.class); InstanceStatus status = this.healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); @@ -116,7 +116,7 @@ public class EurekaHealthCheckHandlerTests { } @Test - public void testUnknown() throws Exception { + void testUnknown() throws Exception { initialize(FatalHealthConfiguration.class); InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN); @@ -125,7 +125,7 @@ public class EurekaHealthCheckHandlerTests { @Test @Disabled // FIXME: 3.0.0 - public void testEurekaIgnored() throws Exception { + void testEurekaIgnored() throws Exception { initialize(EurekaDownHealthConfiguration.class); InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UP); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java index e2a98639e..591a4dafd 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java @@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Ryan Baxter * @author Tim Ysewyn */ -public class EurekaInstanceConfigBeanTests { +class EurekaInstanceConfigBeanTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @@ -53,7 +53,7 @@ public class EurekaInstanceConfigBeanTests { private String ipAddress; @BeforeEach - public void init() throws Exception { + void init() throws Exception { try (InetUtils utils = new InetUtils(new InetUtilsProperties())) { InetUtils.HostInfo hostInfo = utils.findFirstNonLoopbackHostInfo(); this.hostName = hostInfo.getHostname(); @@ -62,28 +62,28 @@ public class EurekaInstanceConfigBeanTests { } @AfterEach - public void clear() { + void clear() { if (this.context != null) { this.context.close(); } } @Test - public void basicBinding() { + void basicBinding() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getAppGroupName()).isEqualTo("mygroup"); } @Test - public void nonSecurePort() { + void nonSecurePort() { TestPropertyValues.of("eureka.instance.nonSecurePort:8888").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getNonSecurePort()).isEqualTo(8888); } @Test - public void instanceId() { + void instanceId() { TestPropertyValues.of("eureka.instance.instanceId:special").applyTo(this.context); setupContext(); EurekaInstanceConfigBean instance = getInstanceConfig(); @@ -91,7 +91,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void initialHostName() { + void initialHostName() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); if (this.hostName != null) { @@ -100,7 +100,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void refreshHostName() { + void refreshHostName() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); ReflectionTestUtils.setField(getInstanceConfig(), "hostname", "marvin"); @@ -112,7 +112,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void refreshHostNameWhenSetByUser() { + void refreshHostNameWhenSetByUser() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); getInstanceConfig().setHostname("marvin"); @@ -122,7 +122,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void initialIpAddress() { + void initialIpAddress() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); if (this.ipAddress != null) { @@ -131,7 +131,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void refreshIpAddress() { + void refreshIpAddress() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); ReflectionTestUtils.setField(getInstanceConfig(), "ipAddress", "10.0.0.1"); @@ -143,7 +143,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void refreshIpAddressWhenSetByUser() { + void refreshIpAddressWhenSetByUser() { TestPropertyValues.of("eureka.instance.appGroupName=mygroup").applyTo(this.context); setupContext(); getInstanceConfig().setIpAddress("10.0.0.1"); @@ -153,12 +153,12 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void testDefaultInitialStatus() { + void testDefaultInitialStatus() { setupContext(); assertThat(getInstanceConfig().getInitialStatus()).as("initialStatus wrong").isEqualTo(InstanceStatus.UP); } - public void testBadInitialStatus() { + void testBadInitialStatus() { TestPropertyValues.of("eureka.instance.initial-status:FOO").applyTo(this.context); Assertions.assertThrows(BeanCreationException.class, () -> { setupContext(); @@ -166,14 +166,14 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void testCustomInitialStatus() { + void testCustomInitialStatus() { TestPropertyValues.of("eureka.instance.initial-status:STARTING").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getInitialStatus()).as("initialStatus wrong").isEqualTo(InstanceStatus.STARTING); } @Test - public void testPreferIpAddress() throws Exception { + void testPreferIpAddress() throws Exception { TestPropertyValues.of("eureka.instance.preferIpAddress:true").applyTo(this.context); setupContext(); EurekaInstanceConfigBean instance = getInstanceConfig(); @@ -183,7 +183,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void testDefaultVirtualHostName() throws Exception { + void testDefaultVirtualHostName() throws Exception { TestPropertyValues.of("spring.application.name:myapp").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getVirtualHostName()).as("virtualHostName wrong").isEqualTo("myapp"); @@ -192,7 +192,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void testCustomVirtualHostName() throws Exception { + void testCustomVirtualHostName() throws Exception { TestPropertyValues.of("spring.application.name:myapp", "eureka.instance.virtualHostName=myvirthost", "eureka.instance.secureVirtualHostName=mysecurevirthost").applyTo(this.context); setupContext(); @@ -203,7 +203,7 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void testDefaultAppName() throws Exception { + void testDefaultAppName() throws Exception { setupContext(); assertThat(getInstanceConfig().getAppname()).as("default app name is wrong").isEqualTo("unknown"); assertThat(getInstanceConfig().getVirtualHostName()).as("default virtual hostname is wrong") @@ -213,21 +213,21 @@ public class EurekaInstanceConfigBeanTests { } @Test - public void testCustomInstanceId() throws Exception { + void testCustomInstanceId() throws Exception { TestPropertyValues.of("eureka.instance.instanceId=myinstance").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getInstanceId()).as("instance id is wrong").isEqualTo("myinstance"); } @Test - public void testCustomInstanceIdWithMetadata() throws Exception { + void testCustomInstanceIdWithMetadata() throws Exception { TestPropertyValues.of("eureka.instance.metadataMap.instanceId=myinstance").applyTo(this.context); setupContext(); assertThat(getInstanceConfig().getInstanceId()).as("instance id is wrong").isEqualTo("myinstance"); } @Test - public void testDefaultInstanceId() throws Exception { + void testDefaultInstanceId() throws Exception { setupContext(); assertThat(getInstanceConfig().getInstanceId()).as("default instance id is wrong").isEqualTo(null); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServiceInstanceTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServiceInstanceTests.java index 7499082c8..350539988 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServiceInstanceTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServiceInstanceTests.java @@ -20,10 +20,10 @@ import com.netflix.appinfo.InstanceInfo; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; -public class EurekaServiceInstanceTests { +class EurekaServiceInstanceTests { @Test - public void getSchemeReturnsNonNull() { + void getSchemeReturnsNonNull() { InstanceInfo instanceInfo = InstanceInfo.Builder.newBuilder().setAppName("test").setHostName("myhost") .setPort(8080).build(); EurekaServiceInstance instance = new EurekaServiceInstance(instanceInfo); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java index 463aa9c7f..332b95d4f 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java @@ -32,12 +32,12 @@ import org.springframework.context.annotation.Configuration; import static org.assertj.core.api.Assertions.assertThat; -public class InstanceInfoFactoryTests { +class InstanceInfoFactoryTests { private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); @Test - public void instanceIdIsHostNameByDefault() throws IOException { + void instanceIdIsHostNameByDefault() throws IOException { InstanceInfo instanceInfo = setupInstance(); try (InetUtils utils = new InetUtils(new InetUtilsProperties())) { assertThat(instanceInfo.getId()).isEqualTo(utils.findFirstNonLoopbackHostInfo().getHostname()); @@ -45,13 +45,13 @@ public class InstanceInfoFactoryTests { } @Test - public void instanceIdIsIpWhenIpPreferred() throws Exception { + void instanceIdIsIpWhenIpPreferred() throws Exception { InstanceInfo instanceInfo = setupInstance("eureka.instance.preferIpAddress:true"); assertThat(instanceInfo.getId().matches("(\\d+\\.){3}\\d+")).isTrue(); } @Test - public void instanceInfoIdIsInstanceIdWhenSet() { + void instanceInfoIdIsInstanceIdWhenSet() { InstanceInfo instanceInfo = setupInstance("eureka.instance.instanceId:special"); assertThat(instanceInfo.getId()).isEqualTo("special"); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java index 49ee89ac7..5aed074fe 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java @@ -33,7 +33,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen * @author Ryan Baxter */ @SpringBootTest(webEnvironment = RANDOM_PORT, classes = RefreshEurekaSampleApplication.class) -public class ConfigRefreshTests { +class ConfigRefreshTests { @Autowired private ApplicationEventPublisher publisher; @@ -48,7 +48,7 @@ public class ConfigRefreshTests { // EurekaClientConfigurationRefresher.onApplicationEvent // ensures that the EurekaClient bean is recreated after a refresh event and that we // reregister the client with the server - public void verifyGetApplications() { + void verifyGetApplications() { if (publisher != null) { publisher.publishEvent(new RefreshScopeRefreshedEvent()); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java index 32213eead..b56d8175c 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java @@ -30,10 +30,10 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Dave Syer * @author Biju Kunjummen */ -public class EurekaClientConfigServerAutoConfigurationTests { +class EurekaClientConfigServerAutoConfigurationTests { @Test - public void offByDefault() { + void offByDefault() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaClientConfigServerAutoConfiguration.class)).run(c -> { assertThat(c.getBeanNamesForType(EurekaInstanceConfigBean.class).length).isEqualTo(0); @@ -41,7 +41,7 @@ public class EurekaClientConfigServerAutoConfigurationTests { } @Test - public void onWhenRequested() { + void onWhenRequested() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaClientConfigServerAutoConfiguration.class, ConfigServerProperties.class, EurekaInstanceConfigBean.class)) @@ -53,7 +53,7 @@ public class EurekaClientConfigServerAutoConfigurationTests { } @Test - public void notOverridingMetamapSettings() { + void notOverridingMetamapSettings() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaClientConfigServerAutoConfiguration.class, ConfigServerProperties.class, EurekaInstanceConfigBean.class)) diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationTests.java index 400a2978c..4a6be56b0 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationTests.java @@ -53,13 +53,13 @@ import static org.mockito.Mockito.when; */ @RunWith(ModifiedClassPathRunner.class) @ClassPathExclusions("spring-webflux-*") -public class EurekaConfigServerBootstrapConfigurationTests { +class EurekaConfigServerBootstrapConfigurationTests { @Rule public OutputCaptureRule output = new OutputCaptureRule(); @Test - public void offByDefault() { + void offByDefault() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class)) .run(context -> { @@ -70,7 +70,7 @@ public class EurekaConfigServerBootstrapConfigurationTests { } @Test - public void properBeansCreatedWhenEnabled() { + void properBeansCreatedWhenEnabled() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class)) .withPropertyValues("spring.cloud.config.discovery.enabled=true").run(context -> { @@ -81,7 +81,7 @@ public class EurekaConfigServerBootstrapConfigurationTests { } @Test - public void eurekaDnsConfigurationWorks() { + void eurekaDnsConfigurationWorks() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class)) .withPropertyValues("spring.cloud.config.discovery.enabled=true", @@ -95,7 +95,7 @@ public class EurekaConfigServerBootstrapConfigurationTests { } @Test - public void eurekaConfigServerInstanceProviderCalled() { + void eurekaConfigServerInstanceProviderCalled() { // FIXME: why do I need to do this? (fails in maven build without it. TomcatURLStreamHandlerFactory.disable(); new SpringApplicationBuilder(TestConfigDiscoveryConfiguration.class) diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests.java index 3aca36460..6a0e58b29 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests.java @@ -42,7 +42,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen properties = { "spring.cloud.config.discovery.enabled=true", "spring.config.use-legacy-processing=true", "eureka.client.webclient.enabled=true", "spring.codec.max-in-memory-size=310000" }, webEnvironment = RANDOM_PORT) -public class EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests { +class EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests { @LocalServerPort private int port; @@ -51,7 +51,7 @@ public class EurekaConfigServerBootstrapConfigurationWebClientIntegrationTests { private WebClientEurekaHttpClient eurekaHttpClient; @Test - public void webClientRespectsCodecProperties() { + void webClientRespectsCodecProperties() { WebClient webClient = eurekaHttpClient.getWebClient(); ClientResponse response = webClient.get().uri("http://localhost:" + port).exchange().block(); assertThat(response).isNotNull(); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientTests.java index 198ccb32a..fbe9296b4 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapConfigurationWebClientTests.java @@ -30,10 +30,10 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Spencer Gibb */ -public class EurekaConfigServerBootstrapConfigurationWebClientTests { +class EurekaConfigServerBootstrapConfigurationWebClientTests { @Test - public void properBeansCreatedWhenEnabled() { + void properBeansCreatedWhenEnabled() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class)) .withPropertyValues("spring.cloud.config.discovery.enabled=true", @@ -46,7 +46,7 @@ public class EurekaConfigServerBootstrapConfigurationWebClientTests { } @Test - public void properBeansCreatedWhenEnabledWebClientDisabled() { + void properBeansCreatedWhenEnabledWebClientDisabled() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(EurekaConfigServerBootstrapConfiguration.class)) .withPropertyValues("spring.cloud.config.discovery.enabled=true").run(context -> { diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapperTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapperTests.java index 4c6970885..12ddbc1c4 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapperTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaConfigServerBootstrapperTests.java @@ -25,10 +25,10 @@ import org.springframework.cloud.config.client.ConfigServerInstanceProvider; import static org.assertj.core.api.Assertions.assertThat; -public class EurekaConfigServerBootstrapperTests { +class EurekaConfigServerBootstrapperTests { @Test - public void notEnabledDoesNotAddInstanceProviderFn() { + void notEnabledDoesNotAddInstanceProviderFn() { new SpringApplicationBuilder(TestConfig.class) .properties("spring.cloud.service-registry.auto-registration.enabled=false") .addBootstrapper(registry -> registry.addCloseListener(event -> { @@ -40,7 +40,7 @@ public class EurekaConfigServerBootstrapperTests { } @Test - public void enabledAddsInstanceProviderFn() { + void enabledAddsInstanceProviderFn() { new SpringApplicationBuilder(TestConfig.class) .properties("spring.cloud.config.discovery.enabled=true", "spring.cloud.service-registry.auto-registration.enabled=false") diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest.java index 66c3235ee..b2c73f8c9 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest.java @@ -37,11 +37,11 @@ import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; @RunWith(ModifiedClassPathRunner.class) @ClassPathExclusions({ "jersey-client-*", "jersey-core-*", "jersey-apache-client4-*", "spring-webflux-*" }) @SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest { +class EurekaHttpClientsOptionalArgsConfigurationNoWebfluxTest { @Test @SuppressWarnings("unchecked") - public void contextFailsWithoutWebClient() { + void contextFailsWithoutWebClient() { ConfigurableApplicationContext ctx = null; try { diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationTest.java index 9d0b6db53..d1e3c9ca2 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaHttpClientsOptionalArgsConfigurationTest.java @@ -36,10 +36,10 @@ import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; @RunWith(ModifiedClassPathRunner.class) @ClassPathExclusions({ "jersey-client-*", "jersey-core-*", "jersey-apache-client4-*" }) @SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class EurekaHttpClientsOptionalArgsConfigurationTest { +class EurekaHttpClientsOptionalArgsConfigurationTest { @Test - public void contextLoadsWithRestTemplate() { + void contextLoadsWithRestTemplate() { new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class) .withPropertyValues("eureka.client.webclient.enabled=false").run(context -> { assertThat(context).hasSingleBean(RestTemplateDiscoveryClientOptionalArgs.class); @@ -48,7 +48,7 @@ public class EurekaHttpClientsOptionalArgsConfigurationTest { } @Test - public void contextLoadsWithWebClient() { + void contextLoadsWithWebClient() { new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class) .withPropertyValues("eureka.client.webclient.enabled=true").run(context -> { assertThat(context).doesNotHaveBean(RestTemplateDiscoveryClientOptionalArgs.class); @@ -57,7 +57,7 @@ public class EurekaHttpClientsOptionalArgsConfigurationTest { } @Test - public void contextLoadsWithRestTemplateAsDefault() { + void contextLoadsWithRestTemplateAsDefault() { new WebApplicationContextRunner().withUserConfiguration(EurekaSampleApplication.class).run(context -> { assertThat(context).hasSingleBean(RestTemplateDiscoveryClientOptionalArgs.class); assertThat(context).doesNotHaveBean(WebClientDiscoveryClientOptionalArgs.class); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java index e83158f1f..efaad2d14 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java @@ -32,13 +32,13 @@ import static org.assertj.core.api.Assertions.assertThat; */ @DirtiesContext @SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class JerseyOptionalArgsConfigurationTest { +class JerseyOptionalArgsConfigurationTest { @Autowired private DiscoveryClientOptionalArgs optionalArgs; @Test - public void contextLoads() { + void contextLoads() { assertThat(optionalArgs).isNotNull(); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java index ff4515db4..6bfbda62a 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java @@ -40,13 +40,13 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = EurekaHealthCheckTests.EurekaHealthCheckApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { "eureka.client.healthcheck.enabled=true", "debug=true" }) @DirtiesContext -public class EurekaHealthCheckTests { +class EurekaHealthCheckTests { @Autowired private EurekaClient discoveryClient; @Test - public void shouldRegisterService() { + void shouldRegisterService() { InstanceInfo.InstanceStatus status = this.discoveryClient.getHealthCheckHandler() .getStatus(InstanceInfo.InstanceStatus.UNKNOWN); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/AbstractEurekaHttpClientTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/AbstractEurekaHttpClientTest.java index fa40304ac..f4bce4324 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/AbstractEurekaHttpClientTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/AbstractEurekaHttpClientTest.java @@ -28,80 +28,80 @@ import static org.assertj.core.api.Assertions.assertThat; /** * @author Haytham Mohamed **/ -public abstract class AbstractEurekaHttpClientTest { +abstract class AbstractEurekaHttpClientTest { protected EurekaHttpClient eurekaHttpClient; protected InstanceInfo info; - abstract public void setup(); + abstract void setup(); @Test - public void testRegister() { + void testRegister() { assertThat(eurekaHttpClient.register(info).getStatusCode()).isEqualTo(HttpStatus.OK.value()); } @Test - public void testCancel() { + void testCancel() { assertThat(eurekaHttpClient.cancel("test", "test").getStatusCode()).isEqualTo(HttpStatus.OK.value()); } @Test - public void testSendHeartBeat() { + void testSendHeartBeat() { assertThat(eurekaHttpClient.sendHeartBeat("test", "test", info, null).getStatusCode()) .isEqualTo(HttpStatus.OK.value()); } @Test - public void testSendHeartBeatFourOFour() { + void testSendHeartBeatFourOFour() { assertThat(eurekaHttpClient.sendHeartBeat("fourOFour", "test", info, null).getStatusCode()) .isEqualTo(HttpStatus.NOT_FOUND.value()); } @Test - public void testStatusUpdate() { + void testStatusUpdate() { assertThat(eurekaHttpClient.statusUpdate("test", "test", InstanceInfo.InstanceStatus.UP, info).getStatusCode()) .isEqualTo(HttpStatus.OK.value()); } @Test - public void testDeleteStatusOverride() { + void testDeleteStatusOverride() { assertThat(eurekaHttpClient.deleteStatusOverride("test", "test", info).getStatusCode()) .isEqualTo(HttpStatus.OK.value()); } @Test - public void testGetApplications() { + void testGetApplications() { Applications entity = eurekaHttpClient.getApplications().getEntity(); assertThat(entity).isNotNull(); assertThat(eurekaHttpClient.getApplications("us", "eu").getEntity()).isNotNull(); } @Test - public void testGetDelta() { + void testGetDelta() { eurekaHttpClient.getDelta().getEntity(); eurekaHttpClient.getDelta("us", "eu").getEntity(); } @Test - public void testGetVips() { + void testGetVips() { eurekaHttpClient.getVip("test"); eurekaHttpClient.getVip("test", "us", "eu"); } @Test - public void testGetSecureVip() { + void testGetSecureVip() { eurekaHttpClient.getSecureVip("test"); eurekaHttpClient.getSecureVip("test", "us", "eu"); } @Test - public void testGetApplication() { + void testGetApplication() { eurekaHttpClient.getApplication("test"); } @Test - public void testGetInstance() { + void testGetInstance() { eurekaHttpClient.getInstance("test"); eurekaHttpClient.getInstance("test", "test"); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java index c44fe2a3e..9f5bc7d94 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java @@ -34,7 +34,7 @@ import org.springframework.test.annotation.DirtiesContext; @SpringBootTest(classes = EurekaServerMockApplication.class, properties = { "debug=true", "security.basic.enabled=true" }, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext -public class RestTemplateEurekaHttpClientTest extends AbstractEurekaHttpClientTest { +class RestTemplateEurekaHttpClientTest extends AbstractEurekaHttpClientTest { @Autowired private InetUtils inetUtils; @@ -43,7 +43,7 @@ public class RestTemplateEurekaHttpClientTest extends AbstractEurekaHttpClientTe private String serviceUrl; @BeforeEach - public void setup() { + void setup() { eurekaHttpClient = new RestTemplateTransportClientFactory().newClient(new DefaultEndpoint(serviceUrl)); EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java index 682699060..6eee9f632 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java @@ -22,10 +22,10 @@ import org.junit.jupiter.api.Test; /** * @author Daniel Lavoie */ -public class RestTemplateTransportClientFactoriesTest { +class RestTemplateTransportClientFactoriesTest { @Test - public void testJerseyIsUnsupported() { + void testJerseyIsUnsupported() { Assertions.assertThrows(UnsupportedOperationException.class, () -> { new RestTemplateTransportClientFactories(new RestTemplateDiscoveryClientOptionalArgs(null)) .newTransportClientFactory(null, null); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java index 6dcca3df6..69881a76e 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java @@ -24,32 +24,32 @@ import org.junit.jupiter.api.Test; /** * @author Daniel Lavoie */ -public class RestTemplateTransportClientFactoryTest { +class RestTemplateTransportClientFactoryTest { private RestTemplateTransportClientFactory transportClientFatory; @BeforeEach - public void setup() { + void setup() { transportClientFatory = new RestTemplateTransportClientFactory(); } @Test - public void testWithoutUserInfo() { + void testWithoutUserInfo() { transportClientFatory.newClient(new DefaultEndpoint("http://localhost:8761")); } @Test - public void testInvalidUserInfo() { + void testInvalidUserInfo() { transportClientFatory.newClient(new DefaultEndpoint("http://test@localhost:8761")); } @Test - public void testUserInfo() { + void testUserInfo() { transportClientFatory.newClient(new DefaultEndpoint("http://test:test@localhost:8761")); } @AfterEach - public void shutdown() { + void shutdown() { transportClientFatory.shutdown(); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java index 720b8687d..d091ded9a 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientEurekaHttpClientTest.java @@ -36,7 +36,7 @@ import org.springframework.web.reactive.function.client.WebClient; properties = { "debug=true", "security.basic.enabled=true", "eureka.client.webclient.enabled=true" }, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext -public class WebClientEurekaHttpClientTest extends AbstractEurekaHttpClientTest { +class WebClientEurekaHttpClientTest extends AbstractEurekaHttpClientTest { @Autowired private InetUtils inetUtils; @@ -45,7 +45,7 @@ public class WebClientEurekaHttpClientTest extends AbstractEurekaHttpClientTest private String serviceUrl; @BeforeEach - public void setup() { + void setup() { eurekaHttpClient = new WebClientTransportClientFactory(WebClient::builder) .newClient(new DefaultEndpoint(serviceUrl)); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoriesTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoriesTest.java index 67cd9bfc9..23083b6a9 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoriesTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoriesTest.java @@ -24,10 +24,10 @@ import org.springframework.web.reactive.function.client.WebClient; /** * @author Daniel Lavoie */ -public class WebClientTransportClientFactoriesTest { +class WebClientTransportClientFactoriesTest { @Test - public void testJerseyIsUnsupported() { + void testJerseyIsUnsupported() { Assertions.assertThrows(UnsupportedOperationException.class, () -> { new WebClientTransportClientFactories(WebClient::builder).newTransportClientFactory(null, null); }); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoryTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoryTest.java index 8e7a90ea0..8b91611f7 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoryTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/WebClientTransportClientFactoryTest.java @@ -26,32 +26,32 @@ import org.springframework.web.reactive.function.client.WebClient; /** * @author Daniel Lavoie */ -public class WebClientTransportClientFactoryTest { +class WebClientTransportClientFactoryTest { private WebClientTransportClientFactory transportClientFatory; @BeforeEach - public void setup() { + void setup() { transportClientFatory = new WebClientTransportClientFactory(WebClient::builder); } @Test - public void testWithoutUserInfo() { + void testWithoutUserInfo() { transportClientFatory.newClient(new DefaultEndpoint("http://localhost:8761")); } @Test - public void testInvalidUserInfo() { + void testInvalidUserInfo() { transportClientFatory.newClient(new DefaultEndpoint("http://test@localhost:8761")); } @Test - public void testUserInfo() { + void testUserInfo() { transportClientFatory.newClient(new DefaultEndpoint("http://test:test@localhost:8761")); } @AfterEach - public void shutdown() { + void shutdown() { transportClientFatory.shutdown(); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/loadbalancer/EurekaLoadBalancerClientConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/loadbalancer/EurekaLoadBalancerClientConfigurationTests.java index 01e56b9c1..a28161f60 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/loadbalancer/EurekaLoadBalancerClientConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/loadbalancer/EurekaLoadBalancerClientConfigurationTests.java @@ -57,14 +57,14 @@ class EurekaLoadBalancerClientConfigurationTests { } @Test - public void shouldSetZoneToDefaultWhenNotSetInMetadata() { + void shouldSetZoneToDefaultWhenNotSetInMetadata() { postprocessor.postprocess(); assertThat(zoneConfig.getZone()).isEqualTo("defaultZone"); } @Test - public void shouldResolveApproximateZoneFromHost() { + void shouldResolveApproximateZoneFromHost() { eurekaInstanceConfig.setHostname("this.is.a.test.com"); eurekaLoadBalancerProperties.setApproximateZoneFromHostname(true); @@ -74,7 +74,7 @@ class EurekaLoadBalancerClientConfigurationTests { } @Test - public void disabledViaProperty() { + void disabledViaProperty() { new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(LoadBalancerEurekaAutoConfiguration.class)) .withPropertyValues("eureka.client.enabled=false").run(context -> { diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java index a84c5f233..e166c9dcf 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java @@ -26,14 +26,14 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class DefaultManagementMetadataProviderTest { +class DefaultManagementMetadataProviderTest { private static final EurekaInstanceConfigBean INSTANCE = mock(EurekaInstanceConfigBean.class); private final ManagementMetadataProvider provider = new DefaultManagementMetadataProvider(); @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { when(INSTANCE.getHostname()).thenReturn("host"); when(INSTANCE.getHealthCheckUrlPath()).thenReturn("health"); when(INSTANCE.getStatusPageUrlPath()).thenReturn("info"); @@ -41,7 +41,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortIsRandomAndManagementPortIsNull() throws Exception { + void serverPortIsRandomAndManagementPortIsNull() throws Exception { int serverPort = 0; String serverContextPath = "/"; String managementContextPath = null; @@ -53,7 +53,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void managementPortIsRandom() throws Exception { + void managementPortIsRandom() throws Exception { int serverPort = 0; String serverContextPath = "/"; String managementContextPath = null; @@ -65,7 +65,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPort() throws Exception { + void serverPort() throws Exception { int serverPort = 7777; String serverContextPath = "/"; String managementContextPath = null; @@ -80,7 +80,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortManagementPort() throws Exception { + void serverPortManagementPort() throws Exception { int serverPort = 7777; String serverContextPath = "/"; String managementContextPath = null; @@ -95,7 +95,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortManagementPortServerContextPath() throws Exception { + void serverPortManagementPortServerContextPath() throws Exception { int serverPort = 7777; String serverContextPath = "/Server"; String managementContextPath = null; @@ -110,7 +110,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortManagementPortServerContextPathManagementContextPath() throws Exception { + void serverPortManagementPortServerContextPathManagementContextPath() throws Exception { int serverPort = 7777; String serverContextPath = "/Server"; String managementContextPath = "/Management"; @@ -125,7 +125,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortServerContextPathManagementContextPath() throws Exception { + void serverPortServerContextPathManagementContextPath() throws Exception { int serverPort = 7777; String serverContextPath = "/Server"; String managementContextPath = "/Management"; @@ -140,7 +140,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortManagementContextPath() throws Exception { + void serverPortManagementContextPath() throws Exception { int serverPort = 7777; String serverContextPath = "/"; String managementContextPath = "/Management"; @@ -155,7 +155,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortServerContextPath() throws Exception { + void serverPortServerContextPath() throws Exception { int serverPort = 7777; String serverContextPath = "/Server"; String managementContextPath = null; @@ -170,7 +170,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void serverPortManagementPortManagementContextPath() throws Exception { + void serverPortManagementPortManagementContextPath() throws Exception { int serverPort = 7777; String serverContextPath = "/"; String managementContextPath = "/Management"; @@ -186,7 +186,7 @@ public class DefaultManagementMetadataProviderTest { } @Test - public void setSecureHealthCheckUrl() throws Exception { + void setSecureHealthCheckUrl() throws Exception { int serverPort = 7777; String serverContextPath = "/"; String managementContextPath = "/Management"; diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientConfigurationTests.java index 847324f09..a6836e3c3 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientConfigurationTests.java @@ -41,7 +41,7 @@ class EurekaReactiveDiscoveryClientConfigurationTests { DiscoveryClientOptionalArgsConfiguration.class, EurekaReactiveDiscoveryClientConfiguration.class)); @Test - public void shouldWorkWithDefaults() { + void shouldWorkWithDefaults() { contextRunner.run(context -> { assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class); assertThat(context).hasSingleBean(ReactiveDiscoveryClientHealthIndicator.class); @@ -49,7 +49,7 @@ class EurekaReactiveDiscoveryClientConfigurationTests { } @Test - public void shouldNotHaveDiscoveryClientWhenDiscoveryDisabled() { + void shouldNotHaveDiscoveryClientWhenDiscoveryDisabled() { contextRunner.withPropertyValues("spring.cloud.discovery.enabled=false").run(context -> { assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class); assertThat(context).doesNotHaveBean(ReactiveDiscoveryClientHealthIndicator.class); @@ -57,7 +57,7 @@ class EurekaReactiveDiscoveryClientConfigurationTests { } @Test - public void shouldNotHaveDiscoveryClientWhenReactiveDiscoveryDisabled() { + void shouldNotHaveDiscoveryClientWhenReactiveDiscoveryDisabled() { contextRunner.withPropertyValues("spring.cloud.discovery.reactive.enabled=false").run(context -> { assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class); assertThat(context).doesNotHaveBean(ReactiveDiscoveryClientHealthIndicator.class); @@ -65,7 +65,7 @@ class EurekaReactiveDiscoveryClientConfigurationTests { } @Test - public void shouldNotHaveDiscoveryClientWhenEurekaClientDisabled() { + void shouldNotHaveDiscoveryClientWhenEurekaClientDisabled() { contextRunner.withPropertyValues("eureka.client.enabled=false").run(context -> { assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class); assertThat(context).doesNotHaveBean(ReactiveDiscoveryClientHealthIndicator.class); @@ -73,7 +73,7 @@ class EurekaReactiveDiscoveryClientConfigurationTests { } @Test - public void worksWithoutWebflux() { + void worksWithoutWebflux() { contextRunner.withClassLoader(new FilteredClassLoader("org.springframework.web.reactive")).run(context -> { assertThat(context).doesNotHaveBean(ReactiveDiscoveryClient.class); assertThat(context).doesNotHaveBean(ReactiveDiscoveryClientHealthIndicator.class); @@ -81,7 +81,7 @@ class EurekaReactiveDiscoveryClientConfigurationTests { } @Test - public void worksWithoutActuator() { + void worksWithoutActuator() { contextRunner.withClassLoader(new FilteredClassLoader("org.springframework.boot.actuate")).run(context -> { assertThat(context).hasSingleBean(ReactiveDiscoveryClient.class); assertThat(context).doesNotHaveBean(ReactiveDiscoveryClientHealthIndicator.class); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientTests.java index 846de171f..9f15b1b00 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/reactive/EurekaReactiveDiscoveryClientTests.java @@ -54,13 +54,13 @@ class EurekaReactiveDiscoveryClientTests { private EurekaReactiveDiscoveryClient client; @Test - public void verifyDefaults() { + void verifyDefaults() { assertThat(client.description()).isEqualTo("Spring Cloud Eureka Reactive Discovery Client"); assertThat(client.getOrder()).isEqualTo(ReactiveDiscoveryClient.DEFAULT_ORDER); } @Test - public void verifyDefaultsWhenUsingEurekaClientConfigBean() { + void verifyDefaultsWhenUsingEurekaClientConfigBean() { EurekaClientConfigBean configBean = new EurekaClientConfigBean(); configBean.setOrder(1); EurekaReactiveDiscoveryClient client = new EurekaReactiveDiscoveryClient(eurekaClient, configBean); @@ -69,14 +69,14 @@ class EurekaReactiveDiscoveryClientTests { } @Test - public void shouldReturnEmptyFluxOfServices() { + void shouldReturnEmptyFluxOfServices() { when(eurekaClient.getApplications()).thenReturn(new Applications()); Flux services = this.client.getServices(); StepVerifier.create(services).expectNextCount(0).expectComplete().verify(); } @Test - public void shouldReturnEmptyFluxOfServicesWhenNoInstancesFound() { + void shouldReturnEmptyFluxOfServicesWhenNoInstancesFound() { Applications applications = new Applications(); applications.addApplication(new Application("my-service")); when(eurekaClient.getApplications()).thenReturn(applications); @@ -85,7 +85,7 @@ class EurekaReactiveDiscoveryClientTests { } @Test - public void shouldReturnFluxOfServices() { + void shouldReturnFluxOfServices() { Applications applications = new Applications(); Application app = new Application("my-service"); app.addInstance(new InstanceInfo("instance", "my-service", "", "127.0.0.1", "", null, null, "", "", "", "", "", @@ -97,14 +97,14 @@ class EurekaReactiveDiscoveryClientTests { } @Test - public void shouldReturnEmptyFluxForNonExistingService() { + void shouldReturnEmptyFluxForNonExistingService() { when(eurekaClient.getInstancesByVipAddress("nonexistent-service", false)).thenReturn(emptyList()); Flux instances = this.client.getInstances("nonexistent-service"); StepVerifier.create(instances).expectNextCount(0).expectComplete().verify(); } @Test - public void shouldReturnFluxOfServiceInstances() { + void shouldReturnFluxOfServiceInstances() { InstanceInfo instanceInfo = new InstanceInfo( new InstanceInfo("instance", "my-service", "", "127.0.0.1", "", null, null, "", "", "", "", "", "", 0, null, "", null, null, null, null, null, null, null, null, null, null)); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java index 59bd7e2bb..3fa2a7eb5 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java @@ -24,10 +24,10 @@ import org.springframework.test.annotation.DirtiesContext; @SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext -public class ApplicationTests { +class ApplicationTests { @Test - public void contextLoads() { + void contextLoads() { } } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java index cb52b50ee..ad7efd77d 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java @@ -41,10 +41,10 @@ import static org.mockito.Mockito.when; * @author Spencer Gibb * @author Tim Ysewyn */ -public class EurekaServiceRegistryTests { +class EurekaServiceRegistryTests { @Test - public void eurekaClientNotShutdownInDeregister() { + void eurekaClientNotShutdownInDeregister() { EurekaServiceRegistry registry = new EurekaServiceRegistry(); CloudEurekaClient eurekaClient = mock(CloudEurekaClient.class); @@ -63,7 +63,7 @@ public class EurekaServiceRegistryTests { } @Test - public void eurekaClientGetStatus() { + void eurekaClientGetStatus() { EurekaServiceRegistry registry = new EurekaServiceRegistry(); EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties())); @@ -99,7 +99,7 @@ public class EurekaServiceRegistryTests { } @Test - public void eurekaClientGetStatusNoInstance() { + void eurekaClientGetStatusNoInstance() { EurekaServiceRegistry registry = new EurekaServiceRegistry(); EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties())); diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/support/ZoneUtilsTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/support/ZoneUtilsTests.java index d241fd151..96052f2f5 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/support/ZoneUtilsTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/support/ZoneUtilsTests.java @@ -24,10 +24,10 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Ryan Baxter * */ -public class ZoneUtilsTests { +class ZoneUtilsTests { @Test - public void extractApproximateZoneTest() { + void extractApproximateZoneTest() { assertThat("foo".equals(ZoneUtils.extractApproximateZone("foo"))).isTrue(); assertThat("bar".equals(ZoneUtils.extractApproximateZone("foo.bar"))).isTrue(); assertThat("world.foo.bar".equals(ZoneUtils.extractApproximateZone("hello.world.foo.bar"))).isTrue(); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationContextTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationContextTests.java index e87bafec4..f993f0c47 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationContextTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationContextTests.java @@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.application.name=eureka", "server.servlet.context-path=/context", "management.security.enabled=false", "management.endpoints.web.exposure.include=*" }) -public class ApplicationContextTests { +class ApplicationContextTests { private static final String BASE_PATH = new WebEndpointProperties().getBasePath(); @@ -49,7 +49,7 @@ public class ApplicationContextTests { private int port = 0; @Test - public void catalogLoads() { + void catalogLoads() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/context/eureka/apps", Map.class); @@ -57,7 +57,7 @@ public class ApplicationContextTests { } @Test - public void dashboardLoads() { + void dashboardLoads() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/context/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -70,21 +70,21 @@ public class ApplicationContextTests { } @Test - public void cssAvailable() { + void cssAvailable() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/context/eureka/css/wro.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test - public void jsAvailable() { + void jsAvailable() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/context/eureka/js/wro.js", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test - public void adminLoads() { + void adminLoads() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardDisabledTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardDisabledTests.java index d702851b6..27e57c08c 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardDisabledTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardDisabledTests.java @@ -32,13 +32,13 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { "spring.application.name=eureka", "eureka.dashboard.enabled=false" }) -public class ApplicationDashboardDisabledTests { +class ApplicationDashboardDisabledTests { @Value("${local.server.port}") private int port = 0; @Test - public void catalogLoads() { + void catalogLoads() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/eureka/apps", Map.class); @@ -46,7 +46,7 @@ public class ApplicationDashboardDisabledTests { } @Test - public void dashboardLoads() { + void dashboardLoads() { ResponseEntity entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port + "/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardPathTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardPathTests.java index 633bf8f6c..f0ad2200e 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardPathTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationDashboardPathTests.java @@ -32,13 +32,13 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { "spring.application.name=eureka", "eureka.dashboard.path=/dashboard" }) -public class ApplicationDashboardPathTests { +class ApplicationDashboardPathTests { @Value("${local.server.port}") private int port = 0; @Test - public void catalogLoads() { + void catalogLoads() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/eureka/apps", Map.class); @@ -46,7 +46,7 @@ public class ApplicationDashboardPathTests { } @Test - public void dashboardLoads() { + void dashboardLoads() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/dashboard", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -63,14 +63,14 @@ public class ApplicationDashboardPathTests { } @Test - public void cssAvailable() { + void cssAvailable() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/eureka/css/wro.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test - public void jsAvailable() { + void jsAvailable() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/eureka/js/wro.js", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationServletPathTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationServletPathTests.java index 8eaa911d0..e4b43ab49 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationServletPathTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationServletPathTests.java @@ -41,7 +41,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen @SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = { "spring.application.name=eureka", "server.servlet.context-path=/servlet", "management.security.enabled=false", "management.endpoints.web.exposure.include=*" }) -public class ApplicationServletPathTests { +class ApplicationServletPathTests { private static final String BASE_PATH = new WebEndpointProperties().getBasePath(); @@ -49,7 +49,7 @@ public class ApplicationServletPathTests { private int port = 0; @Test - public void catalogLoads() { + void catalogLoads() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/servlet/eureka/apps", Map.class); @@ -57,7 +57,7 @@ public class ApplicationServletPathTests { } @Test - public void dashboardLoads() { + void dashboardLoads() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/servlet/", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -70,21 +70,21 @@ public class ApplicationServletPathTests { } @Test - public void cssAvailable() { + void cssAvailable() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/servlet/eureka/css/wro.css", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test - public void jsAvailable() { + void jsAvailable() { ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/servlet/eureka/js/wro.js", String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } @Test - public void adminLoads() { + void adminLoads() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationTests.java index e99990891..3827a94e5 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/ApplicationTests.java @@ -44,7 +44,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen @SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = { "spring.jmx.enabled=true", "management.security.enabled=false", "management.endpoints.web.exposure.include=*" }) -public class ApplicationTests { +class ApplicationTests { private static final String BASE_PATH = new WebEndpointProperties().getBasePath(); @@ -55,7 +55,7 @@ public class ApplicationTests { private ServerCodecs serverCodecs; @Test - public void catalogLoads() { + void catalogLoads() { @SuppressWarnings("rawtypes") ResponseEntity entity = new TestRestTemplate() .getForEntity("http://localhost:" + this.port + "/eureka/apps", Map.class); @@ -63,7 +63,7 @@ public class ApplicationTests { } @Test - public void adminLoads() { + void adminLoads() { HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); @@ -75,7 +75,7 @@ public class ApplicationTests { } @Test - public void noDoubleSlashes() { + void noDoubleSlashes() { String basePath = "http://localhost:" + this.port + "/"; ResponseEntity entity = new TestRestTemplate().getForEntity(basePath, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -85,7 +85,7 @@ public class ApplicationTests { } @Test - public void cssParsedByLess() { + void cssParsedByLess() { String basePath = "http://localhost:" + this.port + "/eureka/css/wro.css"; ResponseEntity entity = new TestRestTemplate().getForEntity(basePath, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); @@ -95,7 +95,7 @@ public class ApplicationTests { } @Test - public void customCodecWorks() throws Exception { + void customCodecWorks() throws Exception { assertThat(this.serverCodecs).as("serverCodecs is wrong type") .isInstanceOf(EurekaServerAutoConfiguration.CloudServerCodecs.class); CodecWrapper codec = this.serverCodecs.getFullJsonCodec(); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java index 6077163cb..413a40481 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerReplicasTests.java @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.springframework.cloud.netflix.eureka.server.EurekaControllerTests.setInstance; -public class EurekaControllerReplicasTests { +class EurekaControllerReplicasTests { String noAuthList1 = "https://test1.com"; @@ -59,20 +59,20 @@ public class EurekaControllerReplicasTests { private InstanceInfo instanceInfo; @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { this.original = ApplicationInfoManager.getInstance(); setInstance(mock(ApplicationInfoManager.class)); instanceInfo = mock(InstanceInfo.class); } @AfterEach - public void teardown() throws Exception { + void teardown() throws Exception { setInstance(this.original); instanceInfo = null; } @Test - public void testFilterReplicasNoAuth() throws Exception { + void testFilterReplicasNoAuth() throws Exception { Map model = new HashMap<>(); StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", empty) .add("available-replicas", noAuthList1).add("unavailable-replicas", noAuthList2) @@ -90,7 +90,7 @@ public class EurekaControllerReplicasTests { } @Test - public void testFilterReplicasAuth() throws Exception { + void testFilterReplicasAuth() throws Exception { Map model = new HashMap<>(); StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", authList2) .add("available-replicas", authList1).add("unavailable-replicas", empty).withInstanceInfo(instanceInfo) @@ -108,7 +108,7 @@ public class EurekaControllerReplicasTests { } @Test - public void testFilterReplicasAuthWithCombinationList() throws Exception { + void testFilterReplicasAuthWithCombinationList() throws Exception { Map model = new HashMap<>(); StatusInfo statusInfo = StatusInfo.Builder.newBuilder().add("registered-replicas", totalAutoList) .add("available-replicas", combinationAuthList1).add("unavailable-replicas", combinationAuthList2) diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerTests.java index 00a8a4f7c..e70afba5d 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaControllerTests.java @@ -44,14 +44,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class EurekaControllerTests { +class EurekaControllerTests { private ApplicationInfoManager infoManager; private ApplicationInfoManager original; @BeforeEach - public void setup() throws Exception { + void setup() throws Exception { PeerEurekaNodes peerEurekaNodes = mock(PeerEurekaNodes.class); when(peerEurekaNodes.getPeerNodesView()).thenReturn(Collections.emptyList()); @@ -82,7 +82,7 @@ public class EurekaControllerTests { } @AfterEach - public void teardown() throws Exception { + void teardown() throws Exception { setInstance(this.original); } @@ -93,7 +93,7 @@ public class EurekaControllerTests { } @Test - public void testStatus() throws Exception { + void testStatus() throws Exception { Map model = new HashMap<>(); EurekaController controller = new EurekaController(infoManager); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaCustomPeerNodesTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaCustomPeerNodesTests.java index dcddd53d7..0bd79f0df 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaCustomPeerNodesTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaCustomPeerNodesTests.java @@ -35,13 +35,13 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = EurekaCustomPeerNodesTests.Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, value = { "spring.application.name=eureka", "server.contextPath=/context", "management.security.enabled=false" }) -public class EurekaCustomPeerNodesTests { +class EurekaCustomPeerNodesTests { @Autowired private PeerEurekaNodes peerEurekaNodes; @Test - public void testCustomPeerNodesShouldTakePrecedenceOverDefault() { + void testCustomPeerNodesShouldTakePrecedenceOverDefault() { assertThat(peerEurekaNodes instanceof CustomEurekaPeerNodes) .as("PeerEurekaNodes should be the user created one").isTrue(); } diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfigurationTest.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfigurationTest.java index 8251f74c5..8794e28cf 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfigurationTest.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/EurekaServerInitializerConfigurationTest.java @@ -28,7 +28,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.verify; @ExtendWith(MockitoExtension.class) -public class EurekaServerInitializerConfigurationTest { +class EurekaServerInitializerConfigurationTest { @Mock private EurekaServerBootstrap eurekaServerBootstrapMock; @@ -39,12 +39,12 @@ public class EurekaServerInitializerConfigurationTest { private boolean callbackCalled; @BeforeEach - public void setUp() { + void setUp() { callbackCalled = false; } @Test - public void testStopWithCallbackCallsStop() { + void testStopWithCallbackCallsStop() { eurekaServerInitializerConfiguration.stop(this::setCallbackCalledTrue); assertThat(callbackCalled).isTrue(); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistryTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistryTests.java index cb2dd0956..a420f0954 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistryTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/InstanceRegistryTests.java @@ -50,7 +50,7 @@ import static org.mockito.Mockito.doReturn; @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, value = { "spring.application.name=eureka", "logging.level.org.springframework." + "cloud.netflix.eureka.server.InstanceRegistry=DEBUG" }) -public class InstanceRegistryTests { +class InstanceRegistryTests { private static final String APP_NAME = "MY-APP-NAME"; @@ -64,7 +64,7 @@ public class InstanceRegistryTests { private InstanceRegistry instanceRegistry; @BeforeEach - public void setup() { + void setup() { this.testEvents.applicationEvents.clear(); } @@ -72,7 +72,7 @@ public class InstanceRegistryTests { private TestEvents testEvents; @Test - public void testRegister() throws Exception { + void testRegister() throws Exception { // creating instance info final LeaseInfo leaseInfo = getLeaseInfo(); final InstanceInfo instanceInfo = getInstanceInfo(APP_NAME, HOST_NAME, INSTANCE_ID, PORT, leaseInfo); @@ -91,7 +91,7 @@ public class InstanceRegistryTests { } @Test - public void testDefaultLeaseDurationRegisterEvent() throws Exception { + void testDefaultLeaseDurationRegisterEvent() throws Exception { // creating instance info final InstanceInfo instanceInfo = getInstanceInfo(APP_NAME, HOST_NAME, INSTANCE_ID, PORT, null); // calling tested method @@ -103,7 +103,7 @@ public class InstanceRegistryTests { } @Test - public void testInternalCancel() throws Exception { + void testInternalCancel() throws Exception { // calling tested method instanceRegistry.internalCancel(APP_NAME, HOST_NAME, false); // event of proper type is registered @@ -119,7 +119,7 @@ public class InstanceRegistryTests { } @Test - public void testRenew() throws Exception { + void testRenew() throws Exception { // Creating two instances of the app final InstanceInfo instanceInfo1 = getInstanceInfo(APP_NAME, HOST_NAME, INSTANCE_ID, PORT, null); final InstanceInfo instanceInfo2 = getInstanceInfo(APP_NAME, HOST_NAME, "my-host-name:8009", 8009, null); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesTests.java index bae9857f2..d2ac43291 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesTests.java @@ -58,7 +58,7 @@ import static org.mockito.Mockito.when; @SpringBootTest(classes = RefreshablePeerEurekaNodesTests.Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, value = { "spring.application.name=eureka-server", "eureka.client.service-url.defaultZone=http://localhost:8678/eureka/" }) -public class RefreshablePeerEurekaNodesTests { +class RefreshablePeerEurekaNodesTests { @Autowired private ConfigurableApplicationContext context; @@ -76,7 +76,7 @@ public class RefreshablePeerEurekaNodesTests { private static final String USE_DNS = "eureka.client.use-dns-for-fetching-service-urls"; @Test - public void notUpdatedWhenDnsIsTrue() { + void notUpdatedWhenDnsIsTrue() { changeProperty("eureka.client.use-dns-for-fetching-service-urls=true", "eureka.client.region=unavailable-region", // to force defaultZone "eureka.client.service-url.defaultZone=https://default-host1:8678/eureka/"); @@ -88,7 +88,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void updatedWhenDnsIsFalse() { + void updatedWhenDnsIsFalse() { changeProperty("eureka.client.use-dns-for-fetching-service-urls=false", "eureka.client.region=unavailable-region", // to force defaultZone "eureka.client.service-url.defaultZone=https://default-host2:8678/eureka/"); @@ -100,7 +100,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void updatedWhenRegionChanged() { + void updatedWhenRegionChanged() { changeProperty("eureka.client.use-dns-for-fetching-service-urls=false", "eureka.client.region=region1", "eureka.client.availability-zones.region1=region1-zone", "eureka.client.availability-zones.region2=region2-zone", @@ -117,7 +117,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void updatedWhenAvailabilityZoneChanged() { + void updatedWhenAvailabilityZoneChanged() { changeProperty("eureka.client.use-dns-for-fetching-service-urls=false", "eureka.client.region=region4", "eureka.client.availability-zones.region3=region3-zone", "eureka.client.service-url.region4-zone=https://region4-zone-host:8678/eureka/", @@ -135,7 +135,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void notUpdatedWhenIrrelevantPropertiesChanged() { + void notUpdatedWhenIrrelevantPropertiesChanged() { // Only way to test this is verifying whether updatePeerEurekaNodes() is invoked. // PeerEurekaNodes.updatePeerEurekaNodes() is not public, hence cannot verify with @@ -165,14 +165,14 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void peerEurekaNodesIsRefreshablePeerEurekaNodes() { + void peerEurekaNodesIsRefreshablePeerEurekaNodes() { assertThat(this.peerEurekaNodes).isNotNull(); assertThat(this.peerEurekaNodes instanceof RefreshablePeerEurekaNodes) .as("PeerEurekaNodes should be an instance of RefreshablePeerEurekaNodes").isTrue(); } @Test - public void serviceUrlsCountAsSoonAsRefreshed() { + void serviceUrlsCountAsSoonAsRefreshed() { changeProperty( "eureka.client.service-url.defaultZone=https://defaul-host3:8678/eureka/,http://defaul-host4:8678/eureka/"); forceUpdate(); @@ -181,7 +181,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void serviceUrlsValueAsSoonAsRefreshed() { + void serviceUrlsValueAsSoonAsRefreshed() { changeProperty("eureka.client.service-url.defaultZone=https://defaul-host4:8678/eureka/"); forceUpdate(); assertThat(serviceUrlMatches("https://defaul-host4:8678/eureka/")) @@ -189,7 +189,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void dashboardUpdatedAsSoonAsRefreshed() { + void dashboardUpdatedAsSoonAsRefreshed() { changeProperty("eureka.client.service-url.defaultZone=https://defaul-host5:8678/eureka/"); forceUpdate(); final ResponseEntity entity = new TestRestTemplate().getForEntity("http://localhost:" + this.port + "/", @@ -202,7 +202,7 @@ public class RefreshablePeerEurekaNodesTests { } @Test - public void notUpdatedForRelaxedKeys() { + void notUpdatedForRelaxedKeys() { changeProperty("eureka.client.use-dns-for-fetching-service-urls=false", "eureka.client.region=unavailable-region", // to force defaultZone "eureka.client.service-url.defaultZone=https://defaul-host6:8678/eureka/"); diff --git a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesWithCustomFiltersTests.java b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesWithCustomFiltersTests.java index 173b4911c..8a13b467c 100644 --- a/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesWithCustomFiltersTests.java +++ b/spring-cloud-netflix-eureka-server/src/test/java/org/springframework/cloud/netflix/eureka/server/RefreshablePeerEurekaNodesWithCustomFiltersTests.java @@ -42,13 +42,13 @@ import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest(classes = RefreshablePeerEurekaNodesWithCustomFiltersTests.Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, value = { "spring.application.name=eureka", "server.contextPath=/context", "management.security.enabled=false" }) -public class RefreshablePeerEurekaNodesWithCustomFiltersTests { +class RefreshablePeerEurekaNodesWithCustomFiltersTests { @Autowired private PeerEurekaNodes peerEurekaNodes; @Test - public void testCustomPeerNodesShouldTakePrecedenceOverDefault() { + void testCustomPeerNodesShouldTakePrecedenceOverDefault() { assertThat(peerEurekaNodes instanceof RefreshablePeerEurekaNodes) .as("PeerEurekaNodes should be an instance of RefreshablePeerEurekaNodes").isTrue();