@Test(expected = NotAuthorizedException.class)
public void automationClientRejectsClientsWithoutDBEntries() {

  when(securityContext.getUserPrincipal()).thenReturn(
      SimplePrincipal.of("CN=clientWithoutDBEntry"));
  when(clientDAO.getClientByName("clientWithoutDBEntry")).thenReturn(Optional.empty());
  factory.provide(request, httpServletRequest);
}