diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTest.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java similarity index 89% rename from spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTest.java rename to spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java index a5ceca8673..8ad0e345d8 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTest.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/BasicErrorControllerIntegrationTests.java @@ -16,6 +16,7 @@ package org.springframework.boot.autoconfigure.web; +import java.net.URI; import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -25,13 +26,15 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.web.BasicErrorControllerIntegrationTests.TestConfiguration; import org.springframework.boot.autoconfigure.web.BasicErrorControllerMockMvcTests.MinimalWebConfiguration; -import org.springframework.boot.autoconfigure.web.BasicErrorControllerMockMvcTests.TestConfiguration; import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.boot.test.TestRestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.http.RequestEntity; import org.springframework.http.ResponseEntity; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -58,7 +61,7 @@ import static org.junit.Assert.assertThat; @WebAppConfiguration @DirtiesContext @IntegrationTest("server.port=0") -public class BasicErrorControllerIntegrationTest { +public class BasicErrorControllerIntegrationTests { @Value("${local.server.port}") private int port; @@ -77,8 +80,10 @@ public class BasicErrorControllerIntegrationTest { @Test @SuppressWarnings("rawtypes") public void testBindingExceptionForMachineClient() throws Exception { - ResponseEntity entity = new TestRestTemplate().getForEntity( - "http://localhost:" + this.port + "/bind", Map.class); + RequestEntity request = RequestEntity + .get(URI.create("http://localhost:" + this.port + "/bind")) + .accept(MediaType.APPLICATION_JSON).build(); + ResponseEntity entity = new TestRestTemplate().exchange(request, Map.class); String resp = entity.getBody().toString(); assertThat(resp, containsString("Error count: 1")); assertThat(resp, containsString("errors=[{")); @@ -120,7 +125,7 @@ public class BasicErrorControllerIntegrationTest { } @RequestMapping("/bind") - public String bind() throws Exception { + public String bind(HttpServletRequest request) throws Exception { BindException error = new BindException(this, "test"); error.rejectValue("foo", "bar.error"); throw error;