Use assertThat from Hamcrest instead of JUnit 4

org.junit.Assert.assertThat() is deprecated as of JUnit 4.13.

See gh-22894
This commit is contained in:
Sam Brannen
2019-05-12 14:00:27 +02:00
parent 724c805211
commit deecab6311
14 changed files with 15 additions and 15 deletions

View File

@@ -25,7 +25,7 @@ import org.springframework.mock.env.MockPropertySource;
import org.springframework.tests.sample.beans.TestBean;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;
/**
@@ -38,7 +38,6 @@ import static org.springframework.beans.factory.support.BeanDefinitionBuilder.ge
public class EnvironmentAccessorIntegrationTests {
@Test
@SuppressWarnings("all")
public void braceAccess() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
bf.registerBeanDefinition("testBean",
@@ -51,6 +50,7 @@ public class EnvironmentAccessorIntegrationTests {
ctx.refresh();
assertThat(ctx.getBean(TestBean.class).getName(), equalTo("myBean"));
ctx.close();
}
}

View File

@@ -36,10 +36,10 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.validation.DataBinder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
/**
* @author Phillip Webb

View File

@@ -46,10 +46,10 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.validation.DataBinder;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**