@Test
    public void testJsonSerializationWithProfile() throws Exception {
        val tokenCredentials = new TokenCredentials("token");
        val profile = new AnonymousProfile();
        tokenCredentials.setUserProfile(profile);

        val jsonSerializer = new JsonSerializer(TokenCredentials.class);
        val json = jsonSerializer.serializeToString(tokenCredentials);
        val result = jsonSerializer.deserializeFromString(json);
        assertEquals(tokenCredentials, result);

    }
Tests {@link TokenCredentials}.

@author Hayden Sartoris
@since 6.0.0
pac4j-core/src/test/java/org/pac4j/core/credentials/TokenCredentialsTests.java