Skip to content

Commit d437963

Browse files
committed
Use assertThat from Hamcrest instead of JUnit 4
org.junit.Assert.assertThat() is deprecated as of JUnit 4.13. See gh-22894
1 parent 0aeb7d1 commit d437963

23 files changed

+23
-12
lines changed

spring-test/src/test/java/org/springframework/mock/web/MockFilterChainTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.junit.Test;
3030

3131
import static org.hamcrest.Matchers.*;
32+
import static org.hamcrest.MatcherAssert.assertThat;
3233
import static org.junit.Assert.*;
3334
import static org.mockito.BDDMockito.*;
3435

spring-test/src/test/java/org/springframework/test/context/ContextHierarchyDirtiesContextTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
3636

3737
import static org.hamcrest.CoreMatchers.*;
38+
import static org.hamcrest.MatcherAssert.assertThat;
3839
import static org.junit.Assert.*;
3940

4041
/**

spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import static java.util.Arrays.stream;
2828
import static java.util.stream.Collectors.toCollection;
2929
import static org.hamcrest.CoreMatchers.equalTo;
30+
import static org.hamcrest.MatcherAssert.assertThat;
3031
import static org.junit.Assert.assertEquals;
31-
import static org.junit.Assert.assertThat;
3232

3333
/**
3434
* Integration tests that verify proper concurrency support between a

spring-test/src/test/java/org/springframework/test/context/configuration/interfaces/TestPropertySourceInterfaceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.springframework.test.context.junit4.SpringRunner;
2626

2727
import static org.hamcrest.CoreMatchers.*;
28-
import static org.junit.Assert.*;
28+
import static org.hamcrest.MatcherAssert.assertThat;
2929

3030
/**
3131
* @author Sam Brannen

spring-test/src/test/java/org/springframework/test/context/env/InlinedPropertiesTestPropertySourceTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
2929

3030
import static org.hamcrest.CoreMatchers.*;
31+
import static org.hamcrest.MatcherAssert.assertThat;
3132
import static org.junit.Assert.*;
3233
import static org.springframework.test.context.support.TestPropertySourceUtils.*;
3334

spring-test/src/test/java/org/springframework/test/context/event/EventPublishingTestExecutionListenerIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import static java.lang.annotation.RetentionPolicy.RUNTIME;
5656
import static org.hamcrest.CoreMatchers.equalTo;
5757
import static org.hamcrest.CoreMatchers.startsWith;
58-
import static org.junit.Assert.assertThat;
58+
import static org.hamcrest.MatcherAssert.assertThat;
5959
import static org.mockito.Mockito.mock;
6060
import static org.mockito.Mockito.never;
6161
import static org.mockito.Mockito.only;

spring-test/src/test/java/org/springframework/test/context/junit4/spr6128/AutowiredQualifierTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.springframework.test.context.ContextConfiguration;
2525
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
2626

27+
import static org.hamcrest.MatcherAssert.assertThat;
2728
import static org.hamcrest.core.IsEqual.*;
28-
import static org.junit.Assert.*;
2929

3030
/**
3131
* Integration tests to verify claims made in <a

spring-test/src/test/java/org/springframework/test/context/support/ContextLoaderUtilsContextHierarchyTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.springframework.test.context.ContextLoader;
3333

3434
import static org.hamcrest.CoreMatchers.*;
35+
import static org.hamcrest.MatcherAssert.assertThat;
3536
import static org.junit.Assert.*;
3637
import static org.springframework.test.context.support.ContextLoaderUtils.*;
3738

spring-test/src/test/java/org/springframework/test/jdbc/JdbcTestUtilsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.jdbc.core.JdbcTemplate;
2525

2626
import static org.hamcrest.Matchers.*;
27-
import static org.junit.Assert.*;
27+
import static org.hamcrest.MatcherAssert.assertThat;
2828
import static org.mockito.BDDMockito.*;
2929

3030
/**

spring-test/src/test/java/org/springframework/test/util/AopTestUtilsTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.springframework.aop.support.AopUtils;
2323

2424
import static org.hamcrest.CoreMatchers.*;
25+
import static org.hamcrest.MatcherAssert.assertThat;
2526
import static org.junit.Assert.*;
2627
import static org.springframework.test.util.AopTestUtils.*;
2728

spring-test/src/test/java/org/springframework/test/web/reactive/server/samples/ResponseEntityTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
import static java.time.Duration.*;
4343
import static org.hamcrest.CoreMatchers.*;
44+
import static org.hamcrest.MatcherAssert.assertThat;
4445
import static org.junit.Assert.*;
4546
import static org.springframework.http.MediaType.*;
4647

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141

4242
import static org.hamcrest.CoreMatchers.equalTo;
4343
import static org.hamcrest.CoreMatchers.sameInstance;
44+
import static org.hamcrest.MatcherAssert.assertThat;
4445
import static org.hamcrest.Matchers.*;
4546
import static org.hamcrest.core.IsNot.not;
46-
import static org.junit.Assert.*;
4747
import static org.mockito.Mockito.*;
4848

4949
/**

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
4747

4848
import static java.util.Arrays.asList;
49+
import static org.hamcrest.MatcherAssert.assertThat;
4950
import static org.hamcrest.Matchers.contains;
5051
import static org.hamcrest.Matchers.equalTo;
5152
import static org.hamcrest.Matchers.isEmptyString;
5253
import static org.hamcrest.Matchers.not;
5354
import static org.hamcrest.Matchers.notNullValue;
5455
import static org.hamcrest.Matchers.nullValue;
5556
import static org.hamcrest.Matchers.sameInstance;
56-
import static org.junit.Assert.assertThat;
5757
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
5858

5959
/**

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcConnectionBuilderSupportTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343

4444
import static org.hamcrest.CoreMatchers.equalTo;
4545
import static org.hamcrest.CoreMatchers.nullValue;
46+
import static org.hamcrest.MatcherAssert.assertThat;
4647
import static org.hamcrest.Matchers.notNullValue;
47-
import static org.junit.Assert.assertThat;
4848
import static org.mockito.Mockito.mock;
4949
import static org.mockito.Mockito.when;
5050

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebClientBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
5050

5151
import static org.hamcrest.CoreMatchers.*;
52-
import static org.junit.Assert.*;
52+
import static org.hamcrest.MatcherAssert.assertThat;
5353

5454
/**
5555
* Integration tests for {@link MockMvcWebClientBuilder}.

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnectionTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
2828

2929
import static org.hamcrest.CoreMatchers.*;
30+
import static org.hamcrest.MatcherAssert.assertThat;
3031
import static org.junit.Assert.*;
3132

3233
/**

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockWebResponseBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.springframework.mock.web.MockHttpServletResponse;
3131

3232
import static org.hamcrest.CoreMatchers.*;
33-
import static org.junit.Assert.*;
33+
import static org.hamcrest.MatcherAssert.assertThat;
3434

3535
/**
3636
* Tests for {@link MockWebResponseBuilder}.

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/webdriver/MockMvcHtmlUnitDriverBuilderTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
4242

4343
import static org.hamcrest.CoreMatchers.*;
44+
import static org.hamcrest.MatcherAssert.assertThat;
4445
import static org.junit.Assert.*;
4546

4647
/**

spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/CustomRequestAttributesRequestContextHolderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import static org.hamcrest.CoreMatchers.instanceOf;
4545
import static org.hamcrest.CoreMatchers.is;
4646
import static org.hamcrest.CoreMatchers.nullValue;
47-
import static org.junit.Assert.assertThat;
47+
import static org.hamcrest.MatcherAssert.assertThat;
4848
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
4949
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
5050
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;

spring-test/src/test/java/org/springframework/test/web/servlet/samples/spr/RequestContextHolderTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
5353

5454
import static org.hamcrest.CoreMatchers.*;
55+
import static org.hamcrest.MatcherAssert.assertThat;
5556
import static org.junit.Assert.*;
5657
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
5758
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

spring-tx/src/test/java/org/springframework/transaction/TxNamespaceHandlerEventTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.tests.beans.CollectingReaderEventListener;
2828

2929
import static org.hamcrest.CoreMatchers.*;
30-
import static org.junit.Assert.*;
30+
import static org.hamcrest.MatcherAssert.assertThat;
3131

3232
/**
3333
* @author Torsten Juergeleit

spring-tx/src/test/java/org/springframework/transaction/annotation/EnableTransactionManagementTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.springframework.transaction.event.TransactionalEventListenerFactory;
4040

4141
import static org.hamcrest.CoreMatchers.*;
42+
import static org.hamcrest.MatcherAssert.assertThat;
4243
import static org.junit.Assert.*;
4344

4445
/**

spring-tx/src/test/java/org/springframework/transaction/interceptor/RollbackRuleTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.springframework.beans.FatalBeanException;
2424

2525
import static org.hamcrest.CoreMatchers.*;
26+
import static org.hamcrest.MatcherAssert.assertThat;
2627
import static org.junit.Assert.*;
2728

2829
/**

0 commit comments

Comments
 (0)