Commit c5add2ef authored by Phillip Webb's avatar Phillip Webb

Use AssertJ in spring-boot-deployment-tests

See gh-5083
parent e214fa09
...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; ...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration Tests for {@link SampleGlassfishDeployApplication}. * Integration Tests for {@link SampleGlassfishDeployApplication}.
...@@ -37,8 +37,8 @@ public class SampleGlassfishDeployApplicationIT { ...@@ -37,8 +37,8 @@ public class SampleGlassfishDeployApplicationIT {
System.out.println(url); System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class); String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertEquals("Hello World", entity.getBody()); assertThat(entity.getBody()).isEqualTo("Hello World");
} }
} }
...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; ...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration Tests for {@link SampleTomcatDeployApplication}. * Integration Tests for {@link SampleTomcatDeployApplication}.
...@@ -34,11 +34,10 @@ public class SampleTomcatDeployApplicationIT { ...@@ -34,11 +34,10 @@ public class SampleTomcatDeployApplicationIT {
@Test @Test
public void testHome() throws Exception { public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/"; String url = "http://localhost:" + this.port + "/bootapp/";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class); String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertEquals("Hello World", entity.getBody()); assertThat(entity.getBody()).isEqualTo("Hello World");
} }
} }
...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; ...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration Tests for {@link SampleTomEEDeployApplication}. * Integration Tests for {@link SampleTomEEDeployApplication}.
...@@ -34,11 +34,10 @@ public class SampleTomEEDeployApplicationIT { ...@@ -34,11 +34,10 @@ public class SampleTomEEDeployApplicationIT {
@Test @Test
public void testHome() throws Exception { public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/"; String url = "http://localhost:" + this.port + "/bootapp/";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class); String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertEquals("Hello World", entity.getBody()); assertThat(entity.getBody()).isEqualTo("Hello World");
} }
} }
...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate; ...@@ -22,7 +22,7 @@ import org.springframework.boot.test.TestRestTemplate;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import static org.junit.Assert.assertEquals; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration Tests for {@link SampleWildFlyDeployApplication}. * Integration Tests for {@link SampleWildFlyDeployApplication}.
...@@ -34,11 +34,10 @@ public class SampleWildFlyDeployApplicationIT { ...@@ -34,11 +34,10 @@ public class SampleWildFlyDeployApplicationIT {
@Test @Test
public void testHome() throws Exception { public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/"; String url = "http://localhost:" + this.port + "/bootapp/";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class); String.class);
assertEquals(HttpStatus.OK, entity.getStatusCode()); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertEquals("Hello World", entity.getBody()); assertThat(entity.getBody()).isEqualTo("Hello World");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment