From c5add2ef08ac8f7a5b5a51bb478ad8a38b4c0ab3 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 6 Feb 2016 15:09:47 -0800 Subject: [PATCH] Use AssertJ in spring-boot-deployment-tests See gh-5083 --- .../java/sample/SampleGlassfishDeployApplicationIT.java | 6 +++--- .../test/java/sample/SampleTomcatDeployApplicationIT.java | 7 +++---- .../test/java/sample/SampleTomEEDeployApplicationIT.java | 7 +++---- .../test/java/sample/SampleWildFlyDeployApplicationIT.java | 7 +++---- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java index ceb681fe08..89e0af9e5d 100644 --- a/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java @@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; /** * Integration Tests for {@link SampleGlassfishDeployApplication}. @@ -37,8 +37,8 @@ public class SampleGlassfishDeployApplicationIT { System.out.println(url); ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); - assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertEquals("Hello World", entity.getBody()); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("Hello World"); } } diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java index ad68e041df..8bbe329ec6 100644 --- a/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java @@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; /** * Integration Tests for {@link SampleTomcatDeployApplication}. @@ -34,11 +34,10 @@ public class SampleTomcatDeployApplicationIT { @Test public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; - System.out.println(url); ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); - assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertEquals("Hello World", entity.getBody()); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("Hello World"); } } diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java index 35c467e2c6..3860d3bfa5 100644 --- a/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java @@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; /** * Integration Tests for {@link SampleTomEEDeployApplication}. @@ -34,11 +34,10 @@ public class SampleTomEEDeployApplicationIT { @Test public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; - System.out.println(url); ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); - assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertEquals("Hello World", entity.getBody()); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("Hello World"); } } diff --git a/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java index 69d6b42757..043274749d 100644 --- a/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java +++ b/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java @@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; /** * Integration Tests for {@link SampleWildFlyDeployApplication}. @@ -34,11 +34,10 @@ public class SampleWildFlyDeployApplicationIT { @Test public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; - System.out.println(url); ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); - assertEquals(HttpStatus.OK, entity.getStatusCode()); - assertEquals("Hello World", entity.getBody()); + assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); + assertThat(entity.getBody()).isEqualTo("Hello World"); } }