@Test public void testWithContent() throws Exception { byte[] expectedBytes = UUID.randomUUID().toString().getBytes(); Response nettyResponse = new Response() { private HttpResponse httpResponse = new DefaultHttpResponse(HTTP_1_0, OK); @Override public HttpResponse httpResponse() { return httpResponse; } }; nettyResponse.setContent(ChannelBuffers.wrappedBuffer(expectedBytes)); ClientResponse resteasyResponse = translate(nettyResponse); assertStatus(resteasyResponse, Status.OK); assertContent(resteasyResponse, expectedBytes); }
@Test public void testWithCustomHeaders() throws Exception { Response nettyResponse = new Response() { private HttpResponse httpResponse = new DefaultHttpResponse(HTTP_1_0, OK); @Override public HttpResponse httpResponse() { return httpResponse; } }; nettyResponse.headers().add("single", "a"); nettyResponse.headers().add("multi", Arrays.asList("a", "b")); ClientResponse resteasyResponse = translate(nettyResponse); assertStatus(resteasyResponse, Status.OK); assertMultivaluedMapEquals( resteasyResponse.getHeaders(), ImmutableMap.<String, Object>of("single", "a", "multi", Arrays.asList("a", "b"))); assertContent(resteasyResponse, ZERO_BYTES); }