@Test
    void verifyUpdateOperation() {
        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(credential));
        val authn = builder.build();

        val builder2 = new DefaultAuthenticationBuilder(CoreAuthenticationTestUtils.getPrincipal());
        builder2.setAuthenticationDate(ZonedDateTime.now(Clock.systemUTC()).plusDays(10));
        builder2.addAttribute("authn2", "value2");
        builder2.addWarning(new DefaultMessageDescriptor("code"));
        val authn2 = builder2.build();

        authn.replaceAttributes(authn2);
        assertTrue(authn.containsAttribute("authn2"));
        assertTrue(authn.containsAttribute("authn2"));
    }
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