Example usage for org.springframework.restdocs.operation OperationResponse getStatus

List of usage examples for org.springframework.restdocs.operation OperationResponse getStatus

Introduction

In this page you can find the example usage for org.springframework.restdocs.operation OperationResponse getStatus.

Prototype

HttpStatus getStatus();

Source Link

Document

Returns the status of the response.

Usage

From source file:io.github.restdocsext.jersey.JerseyResponseConverterTest.java

@Test
public void convers_response() {
    final ClientResponse clientResponse = Mocks.clientResponseBuilder().status(200)
            .header("X-Response-Header1", "SomeValue1").header("X-Response-Header2", "SomeValue2")
            .requestContext(Mocks.clientRequestBuilder()
                    .configProp(RESPONSE_BODY_KEY, "Testing".getBytes(StandardCharsets.UTF_8)).build())
            .build();/*from   w w  w  . jav a 2 s  .  com*/
    final OperationResponse response = new JerseyResponseConverter().convert(clientResponse);
    assertThat(response.getContentAsString(), is("Testing"));
    assertThat(response.getStatus().value(), is(200));
    assertThat(response.getHeaders().getFirst("X-Response-Header1"), is("SomeValue1"));
    assertThat(response.getHeaders().getFirst("X-Response-Header2"), is("SomeValue2"));
}