Search in sources :

Example 56 with HttpHeaders

use of org.springframework.http.HttpHeaders in project spring-framework by spring-projects.

the class RequestMappingExceptionHandlingIntegrationTests method controllerThrowingException.

@Test
public void controllerThrowingException() throws Exception {
    String expected = "Recovered from error: State";
    assertEquals(expected, performGet("/thrown-exception", new HttpHeaders(), String.class).getBody());
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) Test(org.junit.Test)

Example 57 with HttpHeaders

use of org.springframework.http.HttpHeaders in project spring-framework by spring-projects.

the class RequestMappingExceptionHandlingIntegrationTests method controllerReturnsMonoError.

@Test
public void controllerReturnsMonoError() throws Exception {
    String expected = "Recovered from error: Argument";
    assertEquals(expected, performGet("/mono-error", new HttpHeaders(), String.class).getBody());
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) Test(org.junit.Test)

Example 58 with HttpHeaders

use of org.springframework.http.HttpHeaders in project spring-framework by spring-projects.

the class RequestMappingIntegrationTests method longStreamResult.

@Test
public void longStreamResult() throws Exception {
    String[] expected = { "0", "1", "2", "3", "4" };
    assertArrayEquals(expected, performGet("/long-stream-result", new HttpHeaders(), String[].class).getBody());
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) Test(org.junit.Test)

Example 59 with HttpHeaders

use of org.springframework.http.HttpHeaders in project spring-framework by spring-projects.

the class RequestMappingIntegrationTests method handleWithParam.

@Test
public void handleWithParam() throws Exception {
    String expected = "Hello George!";
    assertEquals(expected, performGet("/param?name=George", new HttpHeaders(), String.class).getBody());
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) Test(org.junit.Test)

Example 60 with HttpHeaders

use of org.springframework.http.HttpHeaders in project spring-framework by spring-projects.

the class RequestMappingMessageConversionIntegrationTests method byteBufferResponseBodyWithFlux.

@Test
public void byteBufferResponseBodyWithFlux() throws Exception {
    String expected = "Hello!";
    assertEquals(expected, performGet("/raw-response/flux", new HttpHeaders(), String.class).getBody());
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) Test(org.junit.Test)

Aggregations

HttpHeaders (org.springframework.http.HttpHeaders)1676 Test (org.junit.Test)426 ResponseEntity (org.springframework.http.ResponseEntity)383 HttpEntity (org.springframework.http.HttpEntity)345 Test (org.junit.jupiter.api.Test)273 HashMap (java.util.HashMap)184 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)154 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)127 MediaType (org.springframework.http.MediaType)121 URI (java.net.URI)111 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)102 Map (java.util.Map)97 IOException (java.io.IOException)83 RestTemplate (org.springframework.web.client.RestTemplate)78 ArrayList (java.util.ArrayList)75 MessageHeaders (org.springframework.messaging.MessageHeaders)74 MultiValueMap (org.springframework.util.MultiValueMap)74 HttpStatus (org.springframework.http.HttpStatus)71 List (java.util.List)65 Timed (com.codahale.metrics.annotation.Timed)54