diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java index c1d819950f7..b4560af4496 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-glassfish/src/test/java/sample/SampleGlassfishDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,8 +35,7 @@ public class SampleGlassfishDeployApplicationIT { public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; System.out.println(url); - ResponseEntity entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity 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 entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java index b1bd36cb1d0..9adc31cde44 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomcat/src/test/java/sample/SampleTomcatDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity 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, + 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); } @Test - public void errorFromExceptionForRequestAcceptingJsonProducesAJsonResponse() - throws Exception { - assertThatPathProducesExpectedResponse("/bootapp/exception", - MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON); + public void errorFromExceptionForRequestAcceptingHtmlProducesAnHtmlResponse() throws Exception { + assertThatPathProducesExpectedResponse("/bootapp/exception", MediaType.TEXT_HTML, MediaType.TEXT_HTML); } @Test - 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 request = RequestEntity - .get(URI.create("http://localhost:" + this.port + path)).accept(accept) - .build(); + private void assertThatPathProducesExpectedResponse(String path, MediaType accept, MediaType contentType) { + RequestEntity request = RequestEntity.get(URI.create("http://localhost:" + this.port + path)) + .accept(accept).build(); ResponseEntity 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(); } } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java index e6a1172d83b..68930a30522 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-tomee/src/test/java/sample/SampleTomEEDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,7 @@ public class SampleTomEEDeployApplicationIT { @Test public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; - ResponseEntity entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity 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 entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java index 700f7fdb1a7..d0fc90cac72 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wildfly/src/test/java/sample/SampleWildFlyDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,7 @@ public class SampleWildFlyDeployApplicationIT { @Test public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; - ResponseEntity entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity 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 entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); } diff --git a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java index 48adfd76c55..883ec750572 100644 --- a/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java +++ b/spring-boot-tests/spring-boot-deployment-tests/spring-boot-deployment-test-wlp/src/test/java/sample/SampleWlpDeployApplicationIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,7 @@ public class SampleWlpDeployApplicationIT { @Test public void testHome() throws Exception { String url = "http://localhost:" + this.port + "/bootapp/"; - ResponseEntity entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity 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 entity = new TestRestTemplate().getForEntity(url, - String.class); + ResponseEntity entity = new TestRestTemplate().getForEntity(url, String.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(entity.getBody()).isEqualTo("{\"status\":\"UP\"}"); }