ODataResponse extends ODataRequestResponseBase { public Status getStatus() { return status; } private  ODataResponse(Builder builder); Status getStatus(); @Override String toString();  }
@Test public void testBuilderBinaryBody() { ODataResponse response = new ODataResponse.Builder() .setStatus(ODataResponse.Status.OK) .setHeader("one", "value1") .setHeaders(ImmutableMap.of("two", "value2", "three", "value3")) .setBody(new byte[]{1, 2, 3}) .build(); assertThat(response.getStatus(), is(ODataResponse.Status.OK)); assertThat(response.getHeaders().size(), is(3)); assertThat(response.getHeader("one"), is("value1")); assertThat(response.getHeader("TWO"), is("value2")); assertThat(response.getHeader("Three"), is("value3")); assertThat(response.getBody(), is(new byte[]{1, 2, 3})); }
@Test public void testBuilderTextBody() throws UnsupportedEncodingException { ODataResponse response = new ODataResponse.Builder() .setStatus(ODataResponse.Status.CREATED) .setBodyText("The bike costs € 725", "UTF-8") .build(); assertThat(response.getStatus(), is(ODataResponse.Status.CREATED)); assertThat(response.getBodyText("UTF-8"), is("The bike costs € 725")); }