@Test
    void verifyOperation() {
        val credential = getCredential();
        credential.setCredentialMetadata(new BasicCredentialMetadata(credential));

        val handler = new SimpleTestUsernamePasswordAuthenticationHandler();
        val builder = new DefaultAuthenticationBuilder(CoreAuthenticationTestUtils.getPrincipal());
        builder.addSuccess("test", new DefaultAuthenticationHandlerExecutionResult(handler, credential));
        builder.setCredentials(List.of(getCredential()));

        val result = new DefaultAuthenticationHandlerExecutionResult(new SimpleTestUsernamePasswordAuthenticationHandler(), credential);
        builder.addSuccess("Success", result);
        builder.setFailures(Map.of("Failure1", new FailedLoginException()));
        builder.addFailure("Success", new FailedLoginException());
        assertFalse(builder.hasAttribute("invalid"));
        assertNotNull(builder.build());
    }
This is {@link DefaultAuthenticationBuilderTests}.

@author Misagh Moayyed
@since 6.2.0
core/cas-server-core-authentication-api/src/test/java/org/apereo/cas/authentication/DefaultAuthenticationBuilderTests.java