@Test public void automationClientWhenClientPresent() {

  when(securityContext.getUserPrincipal()).thenReturn(principal);
  when(clientDAO.getClientByName("principal")).thenReturn(Optional.of(client));
  assertThat(factory.provide(request, httpServletRequest)).isEqualTo(automationClient);
}