From d4379630e24090ce086cc7baced731a38a1753d2 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 5 May 2019 17:31:31 +0200 Subject: [PATCH] Use assertThat from Hamcrest instead of JUnit 4 org.junit.Assert.assertThat() is deprecated as of JUnit 4.13. See gh-22894 --- .../java/org/springframework/mock/web/MockFilterChainTests.java | 1 + .../test/context/ContextHierarchyDirtiesContextTests.java | 1 + .../test/context/TestContextConcurrencyTests.java | 2 +- .../interfaces/TestPropertySourceInterfaceTests.java | 2 +- .../context/env/InlinedPropertiesTestPropertySourceTests.java | 1 + .../EventPublishingTestExecutionListenerIntegrationTests.java | 2 +- .../test/context/junit4/spr6128/AutowiredQualifierTests.java | 2 +- .../support/ContextLoaderUtilsContextHierarchyTests.java | 1 + .../java/org/springframework/test/jdbc/JdbcTestUtilsTests.java | 2 +- .../java/org/springframework/test/util/AopTestUtilsTests.java | 1 + .../test/web/reactive/server/samples/ResponseEntityTests.java | 1 + .../test/web/servlet/htmlunit/DelegatingWebConnectionTests.java | 2 +- .../test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java | 2 +- .../servlet/htmlunit/MockMvcConnectionBuilderSupportTests.java | 2 +- .../test/web/servlet/htmlunit/MockMvcWebClientBuilderTests.java | 2 +- .../test/web/servlet/htmlunit/MockMvcWebConnectionTests.java | 1 + .../test/web/servlet/htmlunit/MockWebResponseBuilderTests.java | 2 +- .../htmlunit/webdriver/MockMvcHtmlUnitDriverBuilderTests.java | 1 + .../spr/CustomRequestAttributesRequestContextHolderTests.java | 2 +- .../test/web/servlet/samples/spr/RequestContextHolderTests.java | 1 + .../transaction/TxNamespaceHandlerEventTests.java | 2 +- .../annotation/EnableTransactionManagementTests.java | 1 + .../transaction/interceptor/RollbackRuleTests.java | 1 + 23 files changed, 23 insertions(+), 12 deletions(-) diff --git a/spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java b/spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java index 6aacd13de9..69e8c5e285 100644 --- a/spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java +++ b/spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java @@ -29,6 +29,7 @@ import org.junit.Before; import org.junit.Test; import static org.hamcrest.Matchers.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.*; import static org.mockito.BDDMockito.*; diff --git a/spring-test/src/test/java/org/springframework/test/context/ContextHierarchyDirtiesContextTests.java b/spring-test/src/test/java/org/springframework/test/context/ContextHierarchyDirtiesContextTests.java index c1dcdeff05..2d7c44a7c6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ContextHierarchyDirtiesContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/ContextHierarchyDirtiesContextTests.java @@ -35,6 +35,7 @@ import org.springframework.test.annotation.DirtiesContext.HierarchyMode; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.*; /** diff --git a/spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java b/spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java index 87a8fe5774..3d08bcd401 100644 --- a/spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java @@ -27,8 +27,8 @@ import org.junit.Test; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toCollection; import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; /** * Integration tests that verify proper concurrency support between a diff --git a/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/TestPropertySourceInterfaceTests.java b/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/TestPropertySourceInterfaceTests.java index e63275d045..7b6b8c26b7 100644 --- a/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/TestPropertySourceInterfaceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/TestPropertySourceInterfaceTests.java @@ -25,7 +25,7 @@ import org.springframework.core.env.Environment; import org.springframework.test.context.junit4.SpringRunner; import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.MatcherAssert.assertThat; /** * @author Sam Brannen diff --git a/spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesTestPropertySourceTests.java b/spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesTestPropertySourceTests.java index ff902c6619..e9af47d41d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesTestPropertySourceTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesTestPropertySourceTests.java @@ -28,6 +28,7 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.*; import static org.springframework.test.context.support.TestPropertySourceUtils.*; diff --git a/spring-test/src/test/java/org/springframework/test/context/event/EventPublishingTestExecutionListenerIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/event/EventPublishingTestExecutionListenerIntegrationTests.java index cd7bc64687..cc878fe13b 100644 --- a/spring-test/src/test/java/org/springframework/test/context/event/EventPublishingTestExecutionListenerIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/event/EventPublishingTestExecutionListenerIntegrationTests.java @@ -55,7 +55,7 @@ import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.startsWith; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.only; diff --git a/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java b/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java index 5c32bdfe37..1e7eced86c 100644 --- a/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java @@ -24,8 +24,8 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsEqual.*; -import static org.junit.Assert.*; /** * Integration tests to verify claims made in