diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/data/redis/RedisReactiveHealthContributorAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/data/redis/RedisReactiveHealthContributorAutoConfiguration.java index 3c06fd843ff..1b69195ad0c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/data/redis/RedisReactiveHealthContributorAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/data/redis/RedisReactiveHealthContributorAutoConfiguration.java @@ -16,8 +16,6 @@ package org.springframework.boot.actuate.autoconfigure.data.redis; -import java.util.Map; - import reactor.core.publisher.Flux; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; @@ -51,8 +49,7 @@ import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; public class RedisReactiveHealthContributorAutoConfiguration extends CompositeReactiveHealthContributorConfiguration { - RedisReactiveHealthContributorAutoConfiguration( - Map redisConnectionFactories) { + RedisReactiveHealthContributorAutoConfiguration() { super(RedisReactiveHealthIndicator::new); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AbstractCompositeHealthContributorConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AbstractCompositeHealthContributorConfigurationTests.java index c9eea1eab30..01281465fd4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AbstractCompositeHealthContributorConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/health/AbstractCompositeHealthContributorConfigurationTests.java @@ -123,13 +123,11 @@ abstract class AbstractCompositeHealthContributorConfigurationTests[] value() default {}; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java index d7bb019514c..deabd435d53 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/cassandra/CassandraReactiveDataAutoConfigurationTests.java @@ -79,7 +79,6 @@ class CassandraReactiveDataAutoConfigurationTests { @Test void userTypeResolverShouldBeSet() { this.contextRunner.run((context) -> { - assertThat(context).hasSingleBean(CassandraConverter.class); assertThat(context).hasSingleBean(CassandraConverter.class); assertThat(context.getBean(CassandraConverter.class)).extracting("userTypeResolver") .isInstanceOf(SimpleUserTypeResolver.class); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java index fd22d5001e3..6bdbb235271 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java @@ -142,13 +142,12 @@ class LdapAutoConfigurationTests { this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:389").run((context) -> { assertThat(context).hasSingleBean(ObjectDirectoryMapper.class); ObjectDirectoryMapper objectDirectoryMapper = context.getBean(ObjectDirectoryMapper.class); - ApplicationConversionService conversionService = assertThat(objectDirectoryMapper) - .extracting("converterManager") - .extracting("conversionService") - .asInstanceOf(InstanceOfAssertFactories.type(ApplicationConversionService.class)) - .actual(); - assertThat(conversionService.canConvert(String.class, Name.class)).isTrue(); - assertThat(conversionService.canConvert(Name.class, String.class)).isTrue(); + assertThat(objectDirectoryMapper).extracting("converterManager") + .extracting("conversionService", InstanceOfAssertFactories.type(ApplicationConversionService.class)) + .satisfies((conversionService) -> { + assertThat(conversionService.canConvert(String.class, Name.class)).isTrue(); + assertThat(conversionService.canConvert(Name.class, String.class)).isTrue(); + }); }); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java index 01943c8b23b..95764b42f64 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/Builder.java @@ -300,7 +300,7 @@ public class Builder { } /** - * Creates{@link DockerLog} instance based on the provided {@link BuildLog}. + * Creates {@link DockerLog} instance based on the provided {@link BuildLog}. *

* If the provided {@link BuildLog} instance is an {@link AbstractBuildLog}, the * method returns a {@link BuildLogAdapter}, otherwise it returns a default diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java index 14e60e11bcb..d3344654b0e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerApi.java @@ -87,7 +87,7 @@ public class DockerApi { * Create a new {@link DockerApi} instance. */ public DockerApi() { - this(HttpTransport.create(null), DockerLog.toSystemOut()); + this(null); } /** @@ -96,7 +96,7 @@ public class DockerApi { * @since 2.4.0 */ public DockerApi(DockerHostConfiguration dockerHost) { - this(HttpTransport.create(dockerHost), DockerLog.toSystemOut()); + this(dockerHost, DockerLog.toSystemOut()); } /** diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerLog.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerLog.java index 1a3eb0c3e1a..a0cad166032 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerLog.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/DockerLog.java @@ -34,7 +34,7 @@ public interface DockerLog { void log(String message); /** - * Factory method that returns a {@link DockerLog} the outputs to {@link System#out}. + * Factory method that returns a {@link DockerLog} that outputs to {@link System#out}. * @return {@link DockerLog} instance that logs to system out */ static DockerLog toSystemOut() { @@ -42,7 +42,7 @@ public interface DockerLog { } /** - * Factory method that returns a {@link DockerLog} the outputs to a given + * Factory method that returns a {@link DockerLog} that outputs to a given * {@link PrintStream}. * @param out the print stream used to output the log * @return {@link DockerLog} instance that logs to the given print stream diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuilderTests.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuilderTests.java index 5db918a25b6..7cba312d72e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuilderTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/BuilderTests.java @@ -47,6 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.assertj.core.api.Assertions.assertThatNoException; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; @@ -73,14 +74,12 @@ class BuilderTests { @Test void createWithDockerConfiguration() { - Builder builder = new Builder(BuildLog.toSystemOut()); - assertThat(builder).isNotNull(); + assertThatNoException().isThrownBy(() -> new Builder(BuildLog.toSystemOut())); } @Test void createDockerApiWithLogDockerLogDelegate() { Builder builder = new Builder(BuildLog.toSystemOut()); - assertThat(builder).isNotNull(); assertThat(builder).extracting("docker") .extracting("system") .extracting("log") @@ -90,7 +89,6 @@ class BuilderTests { @Test void createDockerApiWithLogDockerSystemOutDelegate() { Builder builder = new Builder(mock(BuildLog.class)); - assertThat(builder).isNotNull(); assertThat(builder).extracting("docker") .extracting("system") .extracting("log") diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java index 4693276a9e7..979e96bc64d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java @@ -447,7 +447,7 @@ public class Log4J2LoggingSystem extends AbstractLoggingSystem { super.cleanUp(); LoggerContext loggerContext = getLoggerContext(); markAsUninitialized(loggerContext); - StatusConsoleListener listener = (StatusConsoleListener) getLoggerContext().getObject(STATUS_LISTENER_KEY); + StatusConsoleListener listener = (StatusConsoleListener) loggerContext.getObject(STATUS_LISTENER_KEY); if (listener != null) { StatusLogger.getLogger().removeListener(listener); loggerContext.removeObject(STATUS_LISTENER_KEY); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java index cc8e6a9650b..45e3958d1d0 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java @@ -146,15 +146,15 @@ public class ServletWebServerApplicationContext extends GenericWebApplicationCon super.refresh(); } catch (RuntimeException ex) { - try { - WebServer webServer = this.webServer; - if (webServer != null) { + WebServer webServer = this.webServer; + if (webServer != null) { + try { webServer.stop(); webServer.destroy(); } - } - catch (RuntimeException stopOrDestroyEx) { - ex.addSuppressed(stopOrDestroyEx); + catch (RuntimeException stopOrDestroyEx) { + ex.addSuppressed(stopOrDestroyEx); + } } throw ex; } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java index e1b2cafcfa1..e283199b2e3 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/StructuredLoggingJsonPropertiesTests.java @@ -187,7 +187,7 @@ class StructuredLoggingJsonPropertiesTests { } @Test - void shouldReturnFalseWhenPrinterIsEmpty() { + void hasCustomPrinterShouldReturnFalseWhenPrinterIsEmpty() { StackTrace stackTrace = new StackTrace("", null, null, null, null, null); assertThat(stackTrace.hasCustomPrinter()).isFalse(); } diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java index 1c91af3fe14..01809b3bfb0 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/context/ReactiveWebServerApplicationContextTests.java @@ -44,6 +44,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.willThrow; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; /** @@ -148,7 +149,7 @@ class ReactiveWebServerApplicationContextTests { .withStackTraceContaining("WebServer has failed to stop"); WebServer webServer = this.context.getWebServer(); then(webServer).should().stop(); - then(webServer).should(times(0)).destroy(); + then(webServer).should(never()).destroy(); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java index d474256bf60..9b78cc1fe64 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContextTests.java @@ -86,6 +86,7 @@ import static org.mockito.BDDMockito.willThrow; import static org.mockito.Mockito.atMost; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.withSettings; @@ -236,7 +237,7 @@ class ServletWebServerApplicationContextTests { .withStackTraceContaining("WebServer has failed to stop"); WebServer webServer = this.context.getWebServer(); then(webServer).should().stop(); - then(webServer).should(times(0)).destroy(); + then(webServer).should(never()).destroy(); } @Test diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java index 3ea9d8f43a6..49b1340069b 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/server/AbstractServletWebServerFactoryTests.java @@ -169,7 +169,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.then; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; +import static org.mockito.Mockito.never; /** * Base for testing classes that extends {@link AbstractServletWebServerFactory}. @@ -1193,7 +1193,7 @@ public abstract class AbstractServletWebServerFactoryTests { this.webServer = getFactory().getWebServer((servletContext) -> servletContext.addListener(listener)); this.webServer.start(); this.webServer.stop(); - then(listener).should(times(0)).contextDestroyed(any(ServletContextEvent.class)); + then(listener).should(never()).contextDestroyed(any(ServletContextEvent.class)); } @Test diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/build.gradle index d5650c243c5..6a4f8f17a8b 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/build.gradle +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/build.gradle @@ -4,7 +4,7 @@ plugins { id "org.springframework.boot.docker-test" } -description = "Spring Boot Data ElasticSearch smoke test" +description = "Spring Boot Data Elasticsearch smoke test" dependencies { dockerTestImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test")) diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearch8ApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearch8ApplicationTests.java similarity index 98% rename from spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearch8ApplicationTests.java rename to spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearch8ApplicationTests.java index 2954b487991..c5daee55022 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearch8ApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearch8ApplicationTests.java @@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @Testcontainers(disabledWithoutDocker = true) @DataElasticsearchTest -class SampleElasticSearch8ApplicationTests { +class SampleElasticsearch8ApplicationTests { @Container @ServiceConnection diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchApplicationTests.java similarity index 98% rename from spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchApplicationTests.java rename to spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchApplicationTests.java index 357a7fad247..4219ba9a80e 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchApplicationTests.java @@ -38,7 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; */ @Testcontainers(disabledWithoutDocker = true) @DataElasticsearchTest -class SampleElasticSearchApplicationTests { +class SampleElasticsearchApplicationTests { @Container @ServiceConnection diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchSslApplicationTests.java b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchSslApplicationTests.java similarity index 98% rename from spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchSslApplicationTests.java rename to spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchSslApplicationTests.java index 7b092a265d3..8ec45bc39d5 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticSearchSslApplicationTests.java +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-data-elasticsearch/src/dockerTest/java/smoketest/data/elasticsearch/SampleElasticsearchSslApplicationTests.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; @Testcontainers(disabledWithoutDocker = true) @DataElasticsearchTest( properties = { "spring.elasticsearch.connection-timeout=120s", "spring.elasticsearch.socket-timeout=120s" }) -class SampleElasticSearchSslApplicationTests { +class SampleElasticsearchSslApplicationTests { @Container @ServiceConnection