@Test
public void bcryptAuthenticatorCreatesUserOnSuccess() throws Exception {

  when(userDAO.getHashedPassword("sysadmin"))
      .thenReturn(Optional.of(hashedPass));
  User user = bcryptAuthenticator.authenticate(new BasicCredentials("sysadmin", "validpass"))
      .orElseThrow(RuntimeException::new);
  assertThat(user).isEqualTo(User.named("sysadmin"));
}