final String content = "sampleContent";
final InputStream sourceStream = new ByteArrayInputStream(content.getBytes());
final ByteArrayOutputStream targetStream = new ByteArrayOutputStream();
when(mockRequest.getInputStream()).thenReturn(new DelegatingServletInputStream(sourceStream));
when(mockResponse.getOutputStream()).thenReturn(new DelegatingServletOutputStream(targetStream));
victim.doFilter(mockRequest, mockResponse, mockFilterChain);
// not the same response is chained
verify(mockFilterChain, Mockito.never()).doFilter(mockRequest, mockResponse);