Merge branch '1.5.x' into 2.0.x

pull/17198/head
Andy Wilkinson 6 years ago
commit 5c21c68146

@ -35,8 +35,7 @@ public class SampleGlassfishDeployApplicationIT {
public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
@ -45,8 +44,7 @@ public class SampleGlassfishDeployApplicationIT {
public void testHealth() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/actuator/health";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
}

@ -49,64 +49,50 @@ public class SampleTomcatDeployApplicationIT {
public void testHealth() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/actuator/health";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
}
@Test
public void errorFromExceptionForRequestAcceptingAnythingProducesAJsonResponse()
throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/exception", MediaType.ALL,
MediaType.APPLICATION_JSON);
public void errorFromExceptionForRequestAcceptingAnythingProducesAJsonResponse() throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/exception", MediaType.ALL, MediaType.APPLICATION_JSON);
}
@Test
public void errorFromExceptionForRequestAcceptingJsonProducesAJsonResponse()
throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/exception",
MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
public void errorFromExceptionForRequestAcceptingJsonProducesAJsonResponse() throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/exception", MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON);
}
@Test
public void errorFromExceptionForRequestAcceptingHtmlProducesAnHtmlResponse()
throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/exception", MediaType.TEXT_HTML,
MediaType.TEXT_HTML);
public void errorFromExceptionForRequestAcceptingHtmlProducesAnHtmlResponse() throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/exception", MediaType.TEXT_HTML, MediaType.TEXT_HTML);
}
@Test
public void sendErrorForRequestAcceptingAnythingProducesAJsonResponse()
throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/send-error", MediaType.ALL,
MediaType.APPLICATION_JSON);
public void sendErrorForRequestAcceptingAnythingProducesAJsonResponse() throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/send-error", MediaType.ALL, MediaType.APPLICATION_JSON);
}
@Test
public void sendErrorForRequestAcceptingJsonProducesAJsonResponse() throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/send-error",
MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON);
assertThatPathProducesExpectedResponse("/bootapp/send-error", MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON);
}
@Test
public void sendErrorForRequestAcceptingHtmlProducesAnHtmlResponse()
throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/send-error", MediaType.TEXT_HTML,
MediaType.TEXT_HTML);
public void sendErrorForRequestAcceptingHtmlProducesAnHtmlResponse() throws Exception {
assertThatPathProducesExpectedResponse("/bootapp/send-error", MediaType.TEXT_HTML, MediaType.TEXT_HTML);
}
private void assertThatPathProducesExpectedResponse(String path, MediaType accept,
MediaType contentType) {
RequestEntity<Void> request = RequestEntity
.get(URI.create("http://localhost:" + this.port + path)).accept(accept)
.build();
private void assertThatPathProducesExpectedResponse(String path, MediaType accept, MediaType contentType) {
RequestEntity<Void> request = RequestEntity.get(URI.create("http://localhost:" + this.port + path))
.accept(accept).build();
ResponseEntity<String> response = this.rest.exchange(request, String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
assertThat(contentType.isCompatibleWith(response.getHeaders().getContentType()))
.as("%s is compatible with %s", contentType,
response.getHeaders().getContentType())
.isTrue();
.as("%s is compatible with %s", contentType, response.getHeaders().getContentType()).isTrue();
}
}

@ -34,8 +34,7 @@ public class SampleTomEEDeployApplicationIT {
@Test
public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/";
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
@ -44,8 +43,7 @@ public class SampleTomEEDeployApplicationIT {
public void testHealth() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/actuator/health";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
}

@ -34,8 +34,7 @@ public class SampleWildFlyDeployApplicationIT {
@Test
public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/";
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
@ -44,8 +43,7 @@ public class SampleWildFlyDeployApplicationIT {
public void testHealth() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/actuator/health";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
}

@ -34,8 +34,7 @@ public class SampleWlpDeployApplicationIT {
@Test
public void testHome() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/";
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("Hello World");
}
@ -44,8 +43,7 @@ public class SampleWlpDeployApplicationIT {
public void testHealth() throws Exception {
String url = "http://localhost:" + this.port + "/bootapp/actuator/health";
System.out.println(url);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url,
String.class);
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(url, String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}");
}

Loading…
Cancel
Save