WilmaHttpResponseCloner { public WilmaHttpResponse cloneResponse(final WilmaHttpResponse response) { WilmaHttpResponse result = new WilmaHttpResponse(response.isVolatile()); result.setStatusCode(response.getStatusCode()); result.setContentType(response.getContentType()); result.setBody(response.getBody()); copyHeaders(response, result); result.setWilmaMessageId(response.getWilmaMessageId()); return result; }  WilmaHttpResponse cloneResponse(final WilmaHttpResponse response);  }
@Test public void testCloneResponseShouldReturnResponseBody() { response.setBody("body"); WilmaHttpResponse actual = underTest.cloneResponse(response); assertEquals(actual.getBody(), response.getBody()); }
@Test public void testCloneResponseShouldReturnResponseStatusCode() { response.setStatusCode(HttpServletResponse.SC_OK); WilmaHttpResponse actual = underTest.cloneResponse(response); assertEquals(actual.getStatusCode(), response.getStatusCode()); }
@Test public void testCloneResponseShouldReturnResponseContentType() { response.setContentType("text/html"); WilmaHttpResponse actual = underTest.cloneResponse(response); assertEquals(actual.getContentType(), response.getContentType()); }
@Test public void testCloneResponseShouldReturnResponseHeaders() { response.addHeader(CONTENT_TYPE_HEADER, XML_CONTENT); response.addHeader(CONTENT_ENCODING_HEADER, GZIP_CONTENT); WilmaHttpResponse actual = underTest.cloneResponse(response); assertEquals(actual.getHeader(CONTENT_TYPE_HEADER), XML_CONTENT); assertEquals(actual.getHeader(CONTENT_ENCODING_HEADER), GZIP_CONTENT); }
@Test public void testCloneResponseShouldReturnResponseHeaderUpdates() { response.addHeaderUpdate(CONTENT_TYPE_HEADER, XML_CONTENT); response.addHeaderUpdate(CONTENT_ENCODING_HEADER, GZIP_CONTENT); WilmaHttpResponse actual = underTest.cloneResponse(response); assertEquals(actual.getHeaderUpdateValue(CONTENT_TYPE_HEADER), XML_CONTENT); assertEquals(actual.getHeaderUpdateValue(CONTENT_ENCODING_HEADER), GZIP_CONTENT); }
@Test public void testCloneResponseShouldReturnResponseHeaderRemovals() { response.addHeaderRemove(CONTENT_TYPE_HEADER); response.addHeaderRemove(CONTENT_ENCODING_HEADER); WilmaHttpResponse actual = underTest.cloneResponse(response); assertTrue(actual.getHeaderChanges().entrySet().size() == 2); }
@Test public void testCloneResponseShouldReturnRequestHeaders() { response.addRequestHeader(CONTENT_TYPE_HEADER, XML_CONTENT); response.addRequestHeader(CONTENT_ENCODING_HEADER, GZIP_CONTENT); WilmaHttpResponse actual = underTest.cloneResponse(response); assertEquals(actual.getRequestHeader(CONTENT_TYPE_HEADER), XML_CONTENT); assertEquals(actual.getRequestHeader(CONTENT_ENCODING_HEADER), GZIP_CONTENT); }