### Question:
LegacyAuthenticationHandlerAdapter implements AuthenticationHandler { @Override public HandlerResult authenticate(final Credential credential) throws GeneralSecurityException, PreventedException { try { if (this.legacyHandler.authenticate(credentialsAdapter.convert(credential))) { final CredentialMetaData md; if (credential instanceof CredentialMetaData) { md = (CredentialMetaData) credential; } else { md = new BasicCredentialMetaData(credential); } return new HandlerResult(this, md); } else { throw new FailedLoginException( String.format("%s failed to authenticate %s", this.getName(), credential)); } } catch (final AuthenticationException e) { throw new GeneralSecurityException( String.format("%s failed to authenticate %s", this.getName(), credential), e); } } LegacyAuthenticationHandlerAdapter(final org.jasig.cas.authentication.handler.AuthenticationHandler legacy);  LegacyAuthenticationHandlerAdapter(
            final org.jasig.cas.authentication.handler.AuthenticationHandler legacy,
            final CredentialsAdapter adapter); @Override HandlerResult authenticate(final Credential credential); @Override boolean supports(final Credential credential); @Override String getName();  }### Answer:
@Test public void testAuthenticateSuccess() throws Exception { final HandlerResult result = alwaysPassHandler.authenticate(new UsernamePasswordCredential("a", "b")); assertEquals("TestAlwaysPassAuthenticationHandler", result.getHandlerName()); }
@Test(expected = FailedLoginException.class) public void testAuthenticateFailure() throws Exception { alwaysFailHandler.authenticate(new UsernamePasswordCredential("a", "b")); }