Source:
<code>public void zipRequestWrapperTest_shouldReturnTrueIfUnzippedContentReadFromWrapperIsTheSameAsContentBeforeZipping() throws Exception { GlobalProperty property = new GlobalProperty("gzip.acceptCompressedRequestsForPaths", ".*"); Context.getAdministrationService().saveGlobalProperty(property); MockHttpServletRequest req = new MockHttpServletRequest(); req.setContextPath("http://gzipservletpath"); req.addHeader("Content-encoding", "gzip"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); GZIPOutputStream gzOutput = new GZIPOutputStream(stream); PrintWriter pwriter = new PrintWriter(gzOutput); pwriter.write("message string"); pwriter.flush(); gzOutput.finish(); req.setContent(stream.toByteArray()); MockHttpServletResponse resp = new MockHttpServletResponse(); FilterChain fil = mock(FilterChain.class); GZIPFilter gzipFilter = new GZIPFilter(); gzipFilter.doFilterInternal(req, resp, fil); final ArgumentCaptor<HttpServletRequest> argumentCaptor = ArgumentCaptor.forClass(HttpServletRequest.class); Mockito.verify(fil).doFilter(argumentCaptor.capture(), Mockito.any(HttpServletResponse.class)); <START> HttpServletRequest requestArgument = (HttpServletRequest) argumentCaptor.getValue(); <END> try { InputStream iStream = requestArgument.getInputStream(); InputStreamReader iReader = new InputStreamReader(iStream); BufferedReader bufReader = new BufferedReader(iReader); String outputMessage = bufReader.readLine(); Assert.assertEquals(outputMessage.equals("message string"), true); } catch (IOException e) { throw new RuntimeException(); } }</code><technical_language>A blank lines in this test test more readable :) e.g. lines 53, 57, 64, 68</technical_language>

Target:
public void zipRequestWrapperTest_shouldReturnTrueIfUnzippedContentReadFromWrapperIsTheSameAsContentBeforeZipping() throws Exception { GlobalProperty property = new GlobalProperty("gzip.acceptCompressedRequestsForPaths", ".*"); Context.getAdministrationService().saveGlobalProperty(property); MockHttpServletRequest req = new MockHttpServletRequest(); req.setContextPath("http://gzipservletpath"); req.addHeader("Content-encoding", "gzip"); ByteArrayOutputStream stream = new ByteArrayOutputStream(); GZIPOutputStream gzOutput = new GZIPOutputStream(stream); PrintWriter pwriter = new PrintWriter(gzOutput); pwriter.write("message string"); pwriter.flush(); gzOutput.finish(); req.setContent(stream.toByteArray()); MockHttpServletResponse resp = new MockHttpServletResponse(); FilterChain fil = mock(FilterChain.class); GZIPFilter gzipFilter = new GZIPFilter(); gzipFilter.doFilterInternal(req, resp, fil); final ArgumentCaptor<HttpServletRequest> argumentCaptor = ArgumentCaptor.forClass(HttpServletRequest.class); Mockito.verify(fil).doFilter(argumentCaptor.capture(), Mockito.any(HttpServletResponse.class)); HttpServletRequest requestArgument = argumentCaptor.getValue(); try { InputStream iStream = requestArgument.getInputStream(); InputStreamReader iReader = new InputStreamReader(iStream); BufferedReader bufReader = new BufferedReader(iReader); String outputMessage = bufReader.readLine(); Assert.assertEquals(outputMessage.equals("message string"), true); } catch (IOException e) { throw new RuntimeException(); } }