mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '3.5.x' into 4.0.x
Closes gh-48682
This commit is contained in:
+8
-11
@@ -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<C extends ApplicationContext>
|
||||
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<C extends ApplicationContext>
|
||||
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<C extends ApplicationContext>
|
||||
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<C extends ApplicationContext>
|
||||
"%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<C extends ApplicationContext>
|
||||
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<C extends ApplicationContext>
|
||||
* 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<C extends ApplicationContext>
|
||||
* Consider the ancestor contexts as well as the current context.
|
||||
*/
|
||||
INCLUDE_ANCESTORS {
|
||||
|
||||
@Override
|
||||
String[] getBeanNamesForType(ApplicationContext applicationContext, Class<?> type) {
|
||||
return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(applicationContext, type);
|
||||
|
||||
+8
-7
@@ -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<JsonContentAssert, CharSeq
|
||||
* @throws AssertionError if the path is not valid
|
||||
*/
|
||||
public AbstractObjectAssert<?, Object> 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<JsonContentAssert, CharSeq
|
||||
*/
|
||||
public AbstractCharSequenceAssert<?, String> 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<JsonContentAssert, CharSeq
|
||||
* @throws AssertionError if the path is not valid or does not result in a number
|
||||
*/
|
||||
public AbstractObjectAssert<?, Number> 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<JsonContentAssert, CharSeq
|
||||
* @throws AssertionError if the path is not valid or does not result in a boolean
|
||||
*/
|
||||
public AbstractBooleanAssert<?> 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<JsonContentAssert, CharSeq
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <E> ListAssert<E> 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<JsonContentAssert, CharSeq
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <K, V> MapAssert<K, V> 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")
|
||||
|
||||
+10
-15
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
+3
-2
@@ -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<Function> wrappers = (List<Function>) getWrappersMethod.invoke(null);
|
||||
Assertions.assertThat(wrappers).anyMatch((function) -> function.apply(this.parent) instanceof Storage);
|
||||
assertThat(wrappers).anyMatch((function) -> function.apply(this.parent) instanceof Storage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+14
-16
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
+1
-2
@@ -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<String, String> context = new HashMap<>();
|
||||
context.put("arg", "world");
|
||||
Assertions.assertThat(tmpl.execute(context)).isEqualTo("Hello world!");
|
||||
assertThat(tmpl.execute(context)).isEqualTo("Hello world!");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+3
-4
@@ -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"));
|
||||
});
|
||||
}
|
||||
|
||||
+3
-2
@@ -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));
|
||||
}
|
||||
|
||||
+1
-2
@@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
||||
+10
-12
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -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();
|
||||
});
|
||||
|
||||
+3
-2
@@ -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<ImageAssert, ImageReference> {
|
||||
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<JsonContentAssert> assertConsumer) {
|
||||
|
||||
Reference in New Issue
Block a user