### Question:
DefaultAuthenticationFailureManager implements AuthenticationFailureManager { @Override public boolean validateForm(String username, SecurityRequestWrapper request) { boolean result = true; if (!isAuthenticationSecurityEnabled()) { this.authFailures.clear(); } if (isThresholdReached(username)) { for (AuthenticationFailureStrategy authenticationFailureStrategy : getFailureStrategyList()) { result = result && authenticationFailureStrategy.validateForm(username, request); } } if (!result) { this.contextProvider.get().put("message", "invalidcredentials"); } return result; } DefaultAuthenticationFailureManager(); @Override boolean recordAuthenticationFailure(String username); @Override void resetAuthenticationFailureCounter(DocumentReference user); @Override void resetAuthenticationFailureCounter(String username); @Override String getForm(String username); @Override boolean validateForm(String username, SecurityRequestWrapper request); @Override String getErrorMessage(String username); @Override DocumentReference findUser(String username);  }### Answer:
@Test public void validateForm() { String login1 = this.failingLogin; String login2 = "barfoo"; assertTrue(this.defaultAuthenticationFailureManager.validateForm(login1, null)); assertTrue(this.defaultAuthenticationFailureManager.validateForm(login2, null)); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login1); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login1); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login1); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login2); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login2); this.defaultAuthenticationFailureManager.recordAuthenticationFailure(login2); when(this.strategy1.validateForm(login1, null)).thenReturn(true); when(this.strategy2.validateForm(login1, null)).thenReturn(true); assertTrue(this.defaultAuthenticationFailureManager.validateForm(login1, null)); when(this.strategy1.validateForm(login2, null)).thenReturn(true); when(this.strategy2.validateForm(login2, null)).thenReturn(false); assertFalse(this.defaultAuthenticationFailureManager.validateForm(login2, null)); }