use of com.google.gerrit.server.account.AccountException in project gerrit by GerritCodeReview.
the class ProjectBasicAuthFilterTest method shouldFailedAuthenticationAgainstRealm.
@Test
public void shouldFailedAuthenticationAgainstRealm() throws Exception {
initMockedWebSession();
requestBasicAuth(req);
doReturn(true).when(account).isActive();
doThrow(new AccountException("Authentication error")).when(accountManager).authenticate(any());
doReturn(GitBasicAuthPolicy.LDAP).when(authConfig).getGitBasicAuthPolicy();
ProjectBasicAuthFilter basicAuthFilter = new ProjectBasicAuthFilter(webSessionItem, accountCache, accountManager, authConfig, authRequestFactory, pwdVerifier);
basicAuthFilter.doFilter(req, res, chain);
verify(accountManager).authenticate(any());
verify(chain, never()).doFilter(any(), any());
assertThat(res.getStatus()).isEqualTo(HttpServletResponse.SC_UNAUTHORIZED);
}
Aggregations