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

  // GIVEN
  HttpServletRequest request = createMock(HttpServletRequest.class);
  HttpServletResponse response = createMock(HttpServletResponse.class);
  Authentication authentication = createMock(Authentication.class);
  Map<String, List<String>> roles = new HashMap<>();
  roles.put("a", Arrays.asList("r1", "r2", "r3"));
  expect(permissionHelper.getPermissionLabels(authentication))
      .andReturn(roles);
  expect(request.getHeader("X-Forwarded-For")).andReturn("1.2.3.4");
  expect(authentication.getName()).andReturn("admin");
  expect(mockedAuditLogger.isEnabled()).andReturn(true);
  mockedAuditLogger.log(anyObject(AuditEvent.class));
  expectLastCall().times(1);
  replayAll();
  // WHEN
  underTest.onSuccessfulAuthentication(request, response, authentication);
  // THEN
  verifyAll();
}