Merge branch '2.7.x' into 3.0.x

Closes gh-37659
This commit is contained in:
Andy Wilkinson 2023-10-03 10:28:51 +01:00
commit 931584f8af
14 changed files with 26 additions and 26 deletions

View File

@ -30,7 +30,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link ValidationFailureAnalyzer}. * Tests for {@link ValidationFailureAnalyzer}.

View File

@ -43,7 +43,7 @@ import org.springframework.jmx.export.MBeanExporter;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link SpringApplicationAdminJmxAutoConfiguration}. * Tests for {@link SpringApplicationAdminJmxAutoConfiguration}.

View File

@ -34,7 +34,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport; import org.springframework.context.annotation.EnableMBeanExport;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link TomcatDataSourceConfiguration}. * Tests for {@link TomcatDataSourceConfiguration}.

View File

@ -69,7 +69,7 @@ import org.springframework.web.socket.sockjs.client.Transport;
import org.springframework.web.socket.sockjs.client.WebSocketTransport; import org.springframework.web.socket.sockjs.client.WebSocketTransport;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link WebSocketMessagingAutoConfiguration}. * Tests for {@link WebSocketMessagingAutoConfiguration}.

View File

@ -21,7 +21,7 @@ import java.util.concurrent.CountDownLatch;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link SilentExitExceptionHandler}. * Tests for {@link SilentExitExceptionHandler}.

View File

@ -27,7 +27,7 @@ import org.springframework.core.test.tools.SourceFile;
import org.springframework.core.test.tools.TestCompiler; import org.springframework.core.test.tools.TestCompiler;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link AutoConfigureAnnotationProcessor}. * Tests for {@link AutoConfigureAnnotationProcessor}.

View File

@ -59,7 +59,7 @@ import org.springframework.util.FileCopyUtils;
import org.springframework.util.FileSystemUtils; import org.springframework.util.FileSystemUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* A {@code GradleBuild} is used to run a Gradle build using {@link GradleRunner}. * A {@code GradleBuild} is used to run a Gradle build using {@link GradleRunner}.

View File

@ -18,11 +18,11 @@ package org.springframework.boot.context.properties;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link PropertyMapper}. * Tests for {@link PropertyMapper}.
@ -57,7 +57,7 @@ class PropertyMapperTests {
@Test @Test
void fromValueAlwaysApplyingWhenNonNullShouldAlwaysApplyNonNullToSource() { void fromValueAlwaysApplyingWhenNonNullShouldAlwaysApplyNonNullToSource() {
this.map.alwaysApplyingWhenNonNull().from((String) null).toCall(Assertions::fail); this.map.alwaysApplyingWhenNonNull().from((String) null).toCall(() -> fail(null));
} }
@Test @Test
@ -101,14 +101,14 @@ class PropertyMapperTests {
@Test @Test
void whenNonNullWhenSuppliedNullShouldNotMap() { void whenNonNullWhenSuppliedNullShouldNotMap() {
this.map.from(() -> null).whenNonNull().as(String::valueOf).toCall(Assertions::fail); this.map.from(() -> null).whenNonNull().as(String::valueOf).toCall(() -> fail(null));
} }
@Test @Test
void whenNonNullWhenSuppliedThrowsNullPointerExceptionShouldNotMap() { void whenNonNullWhenSuppliedThrowsNullPointerExceptionShouldNotMap() {
this.map.from(() -> { this.map.from(() -> {
throw new NullPointerException(); throw new NullPointerException();
}).whenNonNull().as(String::valueOf).toCall(Assertions::fail); }).whenNonNull().as(String::valueOf).toCall(() -> fail(null));
} }
@Test @Test
@ -119,7 +119,7 @@ class PropertyMapperTests {
@Test @Test
void whenTrueWhenValueIsFalseShouldNotMap() { void whenTrueWhenValueIsFalseShouldNotMap() {
this.map.from(false).whenTrue().toCall(Assertions::fail); this.map.from(false).whenTrue().toCall(() -> fail(null));
} }
@Test @Test
@ -130,17 +130,17 @@ class PropertyMapperTests {
@Test @Test
void whenFalseWhenValueIsTrueShouldNotMap() { void whenFalseWhenValueIsTrueShouldNotMap() {
this.map.from(true).whenFalse().toCall(Assertions::fail); this.map.from(true).whenFalse().toCall(() -> fail(null));
} }
@Test @Test
void whenHasTextWhenValueIsNullShouldNotMap() { void whenHasTextWhenValueIsNullShouldNotMap() {
this.map.from(() -> null).whenHasText().toCall(Assertions::fail); this.map.from(() -> null).whenHasText().toCall(() -> fail(null));
} }
@Test @Test
void whenHasTextWhenValueIsEmptyShouldNotMap() { void whenHasTextWhenValueIsEmptyShouldNotMap() {
this.map.from("").whenHasText().toCall(Assertions::fail); this.map.from("").whenHasText().toCall(() -> fail(null));
} }
@Test @Test
@ -157,7 +157,7 @@ class PropertyMapperTests {
@Test @Test
void whenEqualToWhenValueIsNotEqualShouldNotMatch() { void whenEqualToWhenValueIsNotEqualShouldNotMatch() {
this.map.from("123").whenEqualTo("321").toCall(Assertions::fail); this.map.from("123").whenEqualTo("321").toCall(() -> fail(null));
} }
@Test @Test
@ -169,7 +169,7 @@ class PropertyMapperTests {
@Test @Test
void whenInstanceOfWhenValueIsNotTargetTypeShouldNotMatch() { void whenInstanceOfWhenValueIsNotTargetTypeShouldNotMatch() {
Supplier<Number> supplier = () -> 123L; Supplier<Number> supplier = () -> 123L;
this.map.from(supplier).whenInstanceOf(Double.class).toCall(Assertions::fail); this.map.from(supplier).whenInstanceOf(Double.class).toCall(() -> fail(null));
} }
@Test @Test
@ -180,7 +180,7 @@ class PropertyMapperTests {
@Test @Test
void whenWhenValueDoesNotMatchShouldNotMap() { void whenWhenValueDoesNotMatchShouldNotMap() {
this.map.from("123").when("321"::equals).toCall(Assertions::fail); this.map.from("123").when("321"::equals).toCall(() -> fail(null));
} }
@Test @Test
@ -198,12 +198,12 @@ class PropertyMapperTests {
@Test @Test
void alwaysApplyingWhenNonNullShouldAlwaysApplyNonNullToSource() { void alwaysApplyingWhenNonNullShouldAlwaysApplyNonNullToSource() {
this.map.alwaysApplyingWhenNonNull().from(() -> null).toCall(Assertions::fail); this.map.alwaysApplyingWhenNonNull().from(() -> null).toCall(() -> fail(null));
} }
@Test @Test
void whenWhenValueNotMatchesShouldSupportChainedCalls() { void whenWhenValueNotMatchesShouldSupportChainedCalls() {
this.map.from("123").when("456"::equals).when("123"::equals).toCall(Assertions::fail); this.map.from("123").when("456"::equals).when("123"::equals).toCall(() -> fail(null));
} }
@Test @Test

View File

@ -40,7 +40,7 @@ import org.springframework.util.Assert;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link ValueObjectBinder}. * Tests for {@link ValueObjectBinder}.

View File

@ -36,7 +36,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link BeanCurrentlyInCreationFailureAnalyzer}. * Tests for {@link BeanCurrentlyInCreationFailureAnalyzer}.

View File

@ -29,7 +29,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
/** /**
* Tests for {@link BeanNotOfRequiredTypeFailureAnalyzer}. * Tests for {@link BeanNotOfRequiredTypeFailureAnalyzer}.

View File

@ -29,7 +29,7 @@ import org.springframework.boot.util.LambdaSafe.InvocationResult;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.contains; import static org.mockito.ArgumentMatchers.contains;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;

View File

@ -153,7 +153,7 @@ import static org.assertj.core.api.Assertions.assertThatIOException;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException; import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.fail; import static org.assertj.core.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.then; import static org.mockito.BDDMockito.then;

View File

@ -33,7 +33,7 @@
</module> </module>
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck"> <module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck">
<property name="maximum" value="0"/> <property name="maximum" value="0"/>
<property name="format" value="org\.junit\.Assert\.assert" /> <property name="format" value="org\.junit\.Assert|org\.junit\.jupiter\.api\.Assertions" />
<property name="message" <property name="message"
value="Please use AssertJ imports." /> value="Please use AssertJ imports." />
<property name="ignoreComments" value="true" /> <property name="ignoreComments" value="true" />