@Test
    void verifySerialization() throws Throwable {
        val d = new PasswordExpiringWarningMessageDescriptor("DefaultMessage", 30);
        val handler = new SimpleTestUsernamePasswordAuthenticationHandler();
        handler.addMessageDescriptor(d);
        val credential = new UsernamePasswordCredential("casuser", "resusac");
        val result = handler.authenticate(credential, mock(Service.class));
        assertNotNull(result);
        assertNotNull(result.getPrincipal());
        assertNotNull(result.getWarnings());

        val jsonFile = Files.createTempFile(RandomUtils.randomAlphabetic(8), ".json").toFile();
        MAPPER.writeValue(jsonFile, result);
        val read = MAPPER.readValue(jsonFile, AuthenticationHandlerExecutionResult.class);
        assertEquals(result, read);
    }
This is {@link PasswordExpiringWarningMessageDescriptorTests}.

@author Misagh Moayyed
@since 6.1.0
core/cas-server-core-authentication-api/src/test/java/org/apereo/cas/authentication/support/password/PasswordExpiringWarningMessageDescriptorTests.java