@Test
public void testDoFilter() throws IOException, ServletException {

  SecurityContextHolder.getContext().setAuthentication(null);
  // GIVEN
  HttpServletRequest request = createMock(HttpServletRequest.class);
  HttpServletResponse response = createMock(HttpServletResponse.class);
  FilterChain filterChain = createMock(FilterChain.class);
  expect(request.getHeader("Authorization")).andReturn("Basic ").andReturn(null);
  expect(request.getHeader("X-Forwarded-For")).andReturn("1.2.3.4").anyTimes();
  expect(mockedAuditLogger.isEnabled()).andReturn(true).anyTimes();
  mockedAuditLogger.log(anyObject(AuditEvent.class));
  expectLastCall().times(1);
  filterChain.doFilter(request, response);
  expectLastCall();
  replayAll();
  // WHEN
  underTest.doFilter(request, response, filterChain);
  // THEN
  verifyAll();
}