diff --git a/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java index 6f5be5b15ae..f743efcc1a9 100644 --- a/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/context/assertj/ApplicationContextAssert.java @@ -26,7 +26,6 @@ import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.AbstractObjectArrayAssert; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.AbstractThrowableAssert; -import org.assertj.core.api.Assertions; import org.assertj.core.api.MapAssert; import org.assertj.core.error.BasicErrorMessageFactory; import org.jspecify.annotations.Nullable; @@ -229,8 +228,8 @@ public class ApplicationContextAssert throwAssertionError(contextFailedToStartWhenExpecting(this.startupFailure, "to get beans names with type:%n <%s>", type)); } - return Assertions.assertThat(getApplicationContext().getBeanNamesForType(type)) - .as("Bean names of type <%s> from <%s>", type, getApplicationContext()); + return assertThat(getApplicationContext().getBeanNamesForType(type)).as("Bean names of type <%s> from <%s>", + type, getApplicationContext()); } /** @@ -284,7 +283,7 @@ public class ApplicationContextAssert getApplicationContext(), type, names)); } T bean = (name != null) ? getApplicationContext().getBean(name, type) : null; - return Assertions.assertThat(bean).as("Bean of type <%s> from <%s>", type, getApplicationContext()); + return assertThat(bean).as("Bean of type <%s> from <%s>", type, getApplicationContext()); } private @Nullable String getPrimary(String[] names, Scope scope) { @@ -336,7 +335,7 @@ public class ApplicationContextAssert contextFailedToStartWhenExpecting(this.startupFailure, "to contain a bean of name:%n <%s>", name)); } Object bean = findBean(name); - return Assertions.assertThat(bean).as("Bean of name <%s> from <%s>", name, getApplicationContext()); + return assertThat(bean).as("Bean of name <%s> from <%s>", name, getApplicationContext()); } /** @@ -368,8 +367,8 @@ public class ApplicationContextAssert "%nExpecting:%n <%s>%nto contain a bean of name:%n <%s> (%s)%nbut found:%n <%s> of type <%s>", getApplicationContext(), name, type, bean, bean.getClass())); } - return Assertions.assertThat((T) bean) - .as("Bean of name <%s> and type <%s> from <%s>", name, type, getApplicationContext()); + return assertThat((T) bean).as("Bean of name <%s> and type <%s> from <%s>", name, type, + getApplicationContext()); } private @Nullable Object findBean(String name) { @@ -420,8 +419,8 @@ public class ApplicationContextAssert throwAssertionError( contextFailedToStartWhenExpecting(this.startupFailure, "to get beans of type:%n <%s>", type)); } - return Assertions.assertThat(scope.getBeansOfType(getApplicationContext(), type)) - .as("Beans of type <%s> from <%s>", type, getApplicationContext()); + return assertThat(scope.getBeansOfType(getApplicationContext(), type)).as("Beans of type <%s> from <%s>", type, + getApplicationContext()); } /** @@ -492,7 +491,6 @@ public class ApplicationContextAssert * Limited to the current context. */ NO_ANCESTORS { - @Override String[] getBeanNamesForType(ApplicationContext applicationContext, Class type) { return applicationContext.getBeanNamesForType(type); @@ -509,7 +507,6 @@ public class ApplicationContextAssert * Consider the ancestor contexts as well as the current context. */ INCLUDE_ANCESTORS { - @Override String[] getBeanNamesForType(ApplicationContext applicationContext, Class type) { return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(applicationContext, type); diff --git a/core/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java b/core/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java index 93ce0da1ef1..00cca319d69 100644 --- a/core/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java +++ b/core/spring-boot-test/src/main/java/org/springframework/boot/test/json/JsonContentAssert.java @@ -30,7 +30,6 @@ import org.assertj.core.api.AbstractBooleanAssert; import org.assertj.core.api.AbstractCharSequenceAssert; import org.assertj.core.api.AbstractObjectAssert; import org.assertj.core.api.Assert; -import org.assertj.core.api.Assertions; import org.assertj.core.api.ListAssert; import org.assertj.core.api.MapAssert; import org.jspecify.annotations.Nullable; @@ -44,6 +43,8 @@ import org.springframework.util.ObjectUtils; import org.springframework.util.StringUtils; import org.springframework.util.function.ThrowingFunction; +import static org.assertj.core.api.Assertions.assertThat; + /** * AssertJ {@link Assert} for {@link JsonContent}. * @@ -918,7 +919,7 @@ public class JsonContentAssert extends AbstractAssert extractingJsonPathValue(CharSequence expression, Object... args) { - return Assertions.assertThat(new JsonPathValue(expression, args).getValue(false)); + return assertThat(new JsonPathValue(expression, args).getValue(false)); } /** @@ -931,7 +932,7 @@ public class JsonContentAssert extends AbstractAssert extractingJsonPathStringValue(CharSequence expression, Object... args) { - return Assertions.assertThat(extractingJsonPathValue(expression, args, String.class, "a string")); + return assertThat(extractingJsonPathValue(expression, args, String.class, "a string")); } /** @@ -943,7 +944,7 @@ public class JsonContentAssert extends AbstractAssert extractingJsonPathNumberValue(CharSequence expression, Object... args) { - return Assertions.assertThat(extractingJsonPathValue(expression, args, Number.class, "a number")); + return assertThat(extractingJsonPathValue(expression, args, Number.class, "a number")); } /** @@ -955,7 +956,7 @@ public class JsonContentAssert extends AbstractAssert extractingJsonPathBooleanValue(CharSequence expression, Object... args) { - return Assertions.assertThat(extractingJsonPathValue(expression, args, Boolean.class, "a boolean")); + return assertThat(extractingJsonPathValue(expression, args, Boolean.class, "a boolean")); } /** @@ -969,7 +970,7 @@ public class JsonContentAssert extends AbstractAssert ListAssert extractingJsonPathArrayValue(CharSequence expression, Object... args) { - return Assertions.assertThat(extractingJsonPathValue(expression, args, List.class, "an array")); + return assertThat(extractingJsonPathValue(expression, args, List.class, "an array")); } /** @@ -984,7 +985,7 @@ public class JsonContentAssert extends AbstractAssert MapAssert extractingJsonPathMapValue(CharSequence expression, Object... args) { - return Assertions.assertThat(extractingJsonPathValue(expression, args, Map.class, "a map")); + return assertThat(extractingJsonPathValue(expression, args, Map.class, "a map")); } @SuppressWarnings("unchecked") diff --git a/module/spring-boot-jetty/src/test/java/org/springframework/boot/jetty/autoconfigure/metrics/JettyMetricsAutoConfigurationTests.java b/module/spring-boot-jetty/src/test/java/org/springframework/boot/jetty/autoconfigure/metrics/JettyMetricsAutoConfigurationTests.java index d0ac3f886c4..90b6f33dfd2 100644 --- a/module/spring-boot-jetty/src/test/java/org/springframework/boot/jetty/autoconfigure/metrics/JettyMetricsAutoConfigurationTests.java +++ b/module/spring-boot-jetty/src/test/java/org/springframework/boot/jetty/autoconfigure/metrics/JettyMetricsAutoConfigurationTests.java @@ -19,7 +19,6 @@ package org.springframework.boot.jetty.autoconfigure.metrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.boot.SpringApplication; @@ -63,7 +62,7 @@ class JettyMetricsAutoConfigurationTests { context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext())); assertThat(context).hasSingleBean(JettyServerThreadPoolMetricsBinder.class); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions.assertThat(registry.find("jetty.threads.config.min").meter()).isNotNull(); + assertThat(registry.find("jetty.threads.config.min").meter()).isNotNull(); }); } @@ -76,7 +75,7 @@ class JettyMetricsAutoConfigurationTests { .run((context) -> { context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext())); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions.assertThat(registry.find("jetty.threads.config.min").meter()).isNotNull(); + assertThat(registry.find("jetty.threads.config.min").meter()).isNotNull(); }); } @@ -98,7 +97,7 @@ class JettyMetricsAutoConfigurationTests { context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext())); assertThat(context).hasSingleBean(JettyConnectionMetricsBinder.class); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions.assertThat(registry.find("jetty.connections.messages.in").meter()).isNotNull(); + assertThat(registry.find("jetty.connections.messages.in").meter()).isNotNull(); }); } @@ -111,7 +110,7 @@ class JettyMetricsAutoConfigurationTests { .run((context) -> { context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext())); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions.assertThat(registry.find("jetty.connections.messages.in").meter()).isNotNull(); + assertThat(registry.find("jetty.connections.messages.in").meter()).isNotNull(); }); } @@ -127,11 +126,9 @@ class JettyMetricsAutoConfigurationTests { assertThat(context).hasSingleBean(JettyConnectionMetricsBinder.class) .hasBean("customJettyConnectionMetricsBinder"); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions - .assertThat(registry.find("jetty.connections.messages.in") - .tag("custom-tag-name", "custom-tag-value") - .meter()) - .isNotNull(); + assertThat(registry.find("jetty.connections.messages.in") + .tag("custom-tag-name", "custom-tag-value") + .meter()).isNotNull(); }); } @@ -148,7 +145,7 @@ class JettyMetricsAutoConfigurationTests { context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext())); assertThat(context).hasSingleBean(JettySslHandshakeMetricsBinder.class); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions.assertThat(registry.find("jetty.ssl.handshakes").meter()).isNotNull(); + assertThat(registry.find("jetty.ssl.handshakes").meter()).isNotNull(); }); } @@ -164,7 +161,7 @@ class JettyMetricsAutoConfigurationTests { .run((context) -> { context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext())); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions.assertThat(registry.find("jetty.ssl.handshakes").meter()).isNotNull(); + assertThat(registry.find("jetty.ssl.handshakes").meter()).isNotNull(); }); } @@ -183,9 +180,7 @@ class JettyMetricsAutoConfigurationTests { assertThat(context).hasSingleBean(JettySslHandshakeMetricsBinder.class) .hasBean("customJettySslHandshakeMetricsBinder"); SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class); - Assertions - .assertThat( - registry.find("jetty.ssl.handshakes").tag("custom-tag-name", "custom-tag-value").meter()) + assertThat(registry.find("jetty.ssl.handshakes").tag("custom-tag-name", "custom-tag-value").meter()) .isNotNull(); }); diff --git a/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/OpenTelemetryEventPublishingContextWrapperBeansTestExecutionListenerIntegrationTests.java b/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/OpenTelemetryEventPublishingContextWrapperBeansTestExecutionListenerIntegrationTests.java index 43f8e5c2cb0..35b49897be6 100644 --- a/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/OpenTelemetryEventPublishingContextWrapperBeansTestExecutionListenerIntegrationTests.java +++ b/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/OpenTelemetryEventPublishingContextWrapperBeansTestExecutionListenerIntegrationTests.java @@ -21,13 +21,14 @@ import java.util.List; import java.util.function.Function; import io.opentelemetry.context.ContextStorage; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.boot.micrometer.tracing.opentelemetry.autoconfigure.OpenTelemetryEventPublisherBeansApplicationListener.Wrapper.Storage; import org.springframework.boot.testsupport.classpath.ForkedClassPath; +import static org.assertj.core.api.Assertions.assertThat; + /** * Integration tests for {@link OpenTelemetryEventPublisherBeansTestExecutionListener}. * @@ -45,7 +46,7 @@ class OpenTelemetryEventPublishingContextWrapperBeansTestExecutionListenerIntegr Method getWrappersMethod = wrappersClass.getDeclaredMethod("getWrappers"); getWrappersMethod.setAccessible(true); List wrappers = (List) getWrappersMethod.invoke(null); - Assertions.assertThat(wrappers).anyMatch((function) -> function.apply(this.parent) instanceof Storage); + assertThat(wrappers).anyMatch((function) -> function.apply(this.parent) instanceof Storage); } } diff --git a/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/otlp/OtlpTracingAutoConfigurationIntegrationTests.java b/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/otlp/OtlpTracingAutoConfigurationIntegrationTests.java index ac244d44842..e42e7de54ba 100644 --- a/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/otlp/OtlpTracingAutoConfigurationIntegrationTests.java +++ b/module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/otlp/OtlpTracingAutoConfigurationIntegrationTests.java @@ -32,7 +32,6 @@ import okhttp3.mockwebserver.MockWebServer; import okhttp3.mockwebserver.RecordedRequest; import okio.Buffer; import okio.GzipSource; -import org.assertj.core.api.Assertions; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; import org.eclipse.jetty.io.Content; @@ -99,13 +98,13 @@ class OtlpTracingAutoConfigurationIntegrationTests { assertThat(context.getBean(OtlpHttpSpanExporter.class).flush()) .isSameAs(CompletableResultCode.ofSuccess()); RecordedRequest request = this.mockWebServer.takeRequest(10, TimeUnit.SECONDS); - Assertions.assertThat(request).isNotNull(); - Assertions.assertThat(request.getRequestLine()).contains("/v1/traces"); - Assertions.assertThat(request.getHeader("Content-Type")).isEqualTo("application/x-protobuf"); - Assertions.assertThat(request.getHeader("custom")).isEqualTo("42"); - Assertions.assertThat(request.getBodySize()).isPositive(); + assertThat(request).isNotNull(); + assertThat(request.getRequestLine()).contains("/v1/traces"); + assertThat(request.getHeader("Content-Type")).isEqualTo("application/x-protobuf"); + assertThat(request.getHeader("custom")).isEqualTo("42"); + assertThat(request.getBodySize()).isPositive(); try (Buffer body = request.getBody()) { - Assertions.assertThat(body.readString(StandardCharsets.UTF_8)).contains("org.springframework.boot"); + assertThat(body.readString(StandardCharsets.UTF_8)).contains("org.springframework.boot"); } }); } @@ -123,15 +122,14 @@ class OtlpTracingAutoConfigurationIntegrationTests { assertThat(context.getBean(OtlpHttpSpanExporter.class).flush()) .isSameAs(CompletableResultCode.ofSuccess()); RecordedRequest request = this.mockWebServer.takeRequest(10, TimeUnit.SECONDS); - Assertions.assertThat(request).isNotNull(); - Assertions.assertThat(request.getRequestLine()).contains("/test"); - Assertions.assertThat(request.getHeader("Content-Type")).isEqualTo("application/x-protobuf"); - Assertions.assertThat(request.getHeader("Content-Encoding")).isEqualTo("gzip"); - Assertions.assertThat(request.getBodySize()).isPositive(); + assertThat(request).isNotNull(); + assertThat(request.getRequestLine()).contains("/test"); + assertThat(request.getHeader("Content-Type")).isEqualTo("application/x-protobuf"); + assertThat(request.getHeader("Content-Encoding")).isEqualTo("gzip"); + assertThat(request.getBodySize()).isPositive(); try (Buffer uncompressed = new Buffer(); Buffer body = request.getBody()) { uncompressed.writeAll(new GzipSource(body)); - Assertions.assertThat(uncompressed.readString(StandardCharsets.UTF_8)) - .contains("org.springframework.boot"); + assertThat(uncompressed.readString(StandardCharsets.UTF_8)).contains("org.springframework.boot"); } }); } @@ -150,8 +148,8 @@ class OtlpTracingAutoConfigurationIntegrationTests { .isSameAs(CompletableResultCode.ofSuccess()); RecordedGrpcRequest request = this.mockGrpcServer.takeRequest(10, TimeUnit.SECONDS); assertThat(request).isNotNull(); - Assertions.assertThat(request.headers().get("Content-Type")).isEqualTo("application/grpc"); - Assertions.assertThat(request.headers().get("custom")).isEqualTo("42"); + assertThat(request.headers().get("Content-Type")).isEqualTo("application/grpc"); + assertThat(request.headers().get("custom")).isEqualTo("42"); assertThat(request.bodyAsString()).contains("org.springframework.boot"); }); } diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java index 46936b5419c..d0f8528d2d9 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java @@ -22,7 +22,6 @@ import java.util.Map; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -75,7 +74,7 @@ class MustacheAutoConfigurationServletIntegrationTests { Template tmpl = Mustache.compiler().compile(source); Map context = new HashMap<>(); context.put("arg", "world"); - Assertions.assertThat(tmpl.execute(context)).isEqualTo("Hello world!"); + assertThat(tmpl.execute(context)).isEqualTo("Hello world!"); } @Test diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationTests.java index 4d0a9e7d87f..47f944ecb2d 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationTests.java @@ -20,7 +20,6 @@ import java.util.Arrays; import java.util.function.Supplier; import com.samskivert.mustache.Mustache; -import org.assertj.core.api.Assertions; import org.assertj.core.api.InstanceOfAssertFactories; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -61,7 +60,7 @@ class MustacheAutoConfigurationTests { assertThat(context).hasSingleBean(Mustache.Compiler.class); assertThat(context).hasSingleBean(MustacheResourceTemplateLoader.class); assertThat(context).hasSingleBean(MustacheViewResolver.class); - Assertions.assertThat(context.getBean(Mustache.Compiler.class).standardsMode).isTrue(); + assertThat(context.getBean(Mustache.Compiler.class).standardsMode).isTrue(); }); } @@ -85,7 +84,7 @@ class MustacheAutoConfigurationTests { assertThat(context).doesNotHaveBean(MustacheViewResolver.class); assertThat(context) .hasSingleBean(org.springframework.boot.mustache.reactive.view.MustacheViewResolver.class); - Assertions.assertThat(context.getBean(Mustache.Compiler.class).standardsMode).isTrue(); + assertThat(context.getBean(Mustache.Compiler.class).standardsMode).isTrue(); }); } @@ -116,7 +115,7 @@ class MustacheAutoConfigurationTests { assertThat(viewResolver).extracting("prefix").isEqualTo("classpath:/templates/"); assertThat(viewResolver).extracting("requestContextAttribute").isNull(); assertThat(viewResolver).extracting("suffix").isEqualTo(".mustache"); - Assertions.assertThat(viewResolver.getSupportedMediaTypes()) + assertThat(viewResolver.getSupportedMediaTypes()) .containsExactly(MediaType.parseMediaType("text/html;charset=UTF-8")); }); } diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewTests.java index f45679f560d..f8fad25a10a 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewTests.java @@ -21,7 +21,6 @@ import java.time.Duration; import java.util.Collections; import com.samskivert.mustache.Mustache; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import reactor.test.StepVerifier; @@ -31,6 +30,8 @@ import org.springframework.http.MediaType; import org.springframework.mock.http.server.reactive.MockServerHttpRequest; import org.springframework.mock.web.server.MockServerWebExchange; +import static org.assertj.core.api.Assertions.assertThat; + /** * Tests for {@link MustacheView}. * @@ -52,7 +53,7 @@ class MustacheViewTests { view.render(Collections.singletonMap("World", "Spring"), MediaType.TEXT_HTML, exchange) .block(Duration.ofSeconds(30)); StepVerifier.create(exchange.getResponse().getBodyAsString()) - .assertNext((body) -> Assertions.assertThat(body).isEqualToIgnoringWhitespace("Hello Spring")) + .assertNext((body) -> assertThat(body).isEqualToIgnoringWhitespace("Hello Spring")) .expectComplete() .verify(Duration.ofSeconds(30)); } diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java index 0483a8bd526..4cf560c967a 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java @@ -18,7 +18,6 @@ package org.springframework.boot.mustache.servlet.view; import java.util.Locale; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -66,7 +65,7 @@ class MustacheViewResolverTests { this.resolver.setContentType("application/octet-stream"); View view = this.resolver.resolveViewName("template", Locale.ROOT); assertThat(view).isNotNull(); - Assertions.assertThat(view.getContentType()).isEqualTo("application/octet-stream"); + assertThat(view.getContentType()).isEqualTo("application/octet-stream"); } diff --git a/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafReactiveAutoConfigurationTests.java b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafReactiveAutoConfigurationTests.java index ea7307ee6f7..3e94c5feb4e 100644 --- a/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafReactiveAutoConfigurationTests.java +++ b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafReactiveAutoConfigurationTests.java @@ -25,7 +25,6 @@ import java.util.Locale; import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect; import nz.net.ultraq.thymeleaf.layoutdialect.decorators.strategies.GroupingStrategy; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; @@ -90,27 +89,26 @@ class ThymeleafReactiveAutoConfigurationTests { assertThat(resolver).isInstanceOf(SpringResourceTemplateResolver.class); assertThat(((SpringResourceTemplateResolver) resolver).getCharacterEncoding()).isEqualTo("UTF-16"); ThymeleafReactiveViewResolver views = context.getBean(ThymeleafReactiveViewResolver.class); - Assertions.assertThat(views.getDefaultCharset().name()).isEqualTo("UTF-16"); + assertThat(views.getDefaultCharset().name()).isEqualTo("UTF-16"); }); } @Test void defaultMediaTypes() { - this.contextRunner.run((context) -> Assertions - .assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes()) - .containsExactly(MediaType.TEXT_HTML, MediaType.APPLICATION_XHTML_XML, MediaType.APPLICATION_XML, - MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML, MediaType.APPLICATION_ATOM_XML, - new MediaType("application", "javascript"), new MediaType("application", "ecmascript"), - new MediaType("text", "javascript"), new MediaType("text", "ecmascript"), - MediaType.APPLICATION_JSON, new MediaType("text", "css"), MediaType.TEXT_PLAIN, - MediaType.TEXT_EVENT_STREAM)); + this.contextRunner + .run((context) -> assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes()) + .containsExactly(MediaType.TEXT_HTML, MediaType.APPLICATION_XHTML_XML, MediaType.APPLICATION_XML, + MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML, MediaType.APPLICATION_ATOM_XML, + new MediaType("application", "javascript"), new MediaType("application", "ecmascript"), + new MediaType("text", "javascript"), new MediaType("text", "ecmascript"), + MediaType.APPLICATION_JSON, new MediaType("text", "css"), MediaType.TEXT_PLAIN, + MediaType.TEXT_EVENT_STREAM)); } @Test void overrideMediaTypes() { this.contextRunner.withPropertyValues("spring.thymeleaf.reactive.media-types:text/html,text/plain") - .run((context) -> Assertions - .assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes()) + .run((context) -> assertThat(context.getBean(ThymeleafReactiveViewResolver.class).getSupportedMediaTypes()) .containsExactly(MediaType.TEXT_HTML, MediaType.TEXT_PLAIN)); } diff --git a/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java index f5f508b204e..e5493bb6ed5 100644 --- a/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java +++ b/module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java @@ -28,7 +28,6 @@ import jakarta.servlet.DispatcherType; import jakarta.servlet.ServletContext; import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect; import nz.net.ultraq.thymeleaf.layoutdialect.decorators.strategies.GroupingStrategy; -import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; @@ -358,7 +357,7 @@ class ThymeleafServletAutoConfigurationTests { @Test void cachingCanBeDisabled() { this.contextRunner.withPropertyValues("spring.thymeleaf.cache:false").run((context) -> { - Assertions.assertThat(context.getBean(ThymeleafViewResolver.class).isCache()).isFalse(); + assertThat(context.getBean(ThymeleafViewResolver.class).isCache()).isFalse(); SpringResourceTemplateResolver templateResolver = context.getBean(SpringResourceTemplateResolver.class); assertThat(templateResolver.isCacheable()).isFalse(); }); diff --git a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java index fbc242a647d..1501c151463 100644 --- a/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java +++ b/system-test/spring-boot-image-system-tests/src/systemTest/java/org/springframework/boot/image/assertions/ImageAssert.java @@ -27,7 +27,6 @@ import java.util.function.Consumer; import org.apache.commons.compress.archivers.tar.TarArchiveEntry; import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; import org.assertj.core.api.AbstractAssert; -import org.assertj.core.api.Assertions; import org.assertj.core.api.ListAssert; import org.springframework.boot.buildpack.platform.docker.DockerApi; @@ -36,6 +35,8 @@ import org.springframework.boot.buildpack.platform.docker.type.Layer; import org.springframework.boot.test.json.JsonContentAssert; import org.springframework.util.StreamUtils; +import static org.assertj.core.api.Assertions.assertThat; + /** * AssertJ {@link org.assertj.core.api.Assert} for Docker image contents. * @@ -92,7 +93,7 @@ public class ImageAssert extends AbstractAssert { catch (IOException ex) { failWithMessage("IOException while reading image layer archive: '%s'", ex.getMessage()); } - return Assertions.assertThat(entryNames); + return assertThat(entryNames); } public void jsonEntry(String name, Consumer assertConsumer) {