@Test
    public void testReadWriteObjectNullIdToken() {
        var profile = new OidcProfile();
        profile.setAccessToken(populatedAccessToken);
        profile.setRefreshToken(new RefreshToken(REFRESH_TOKEN));
        var result = JAVA_SERIALIZER.serializeToBytes(profile);
        profile = (OidcProfile) JAVA_SERIALIZER.deserializeFromBytes(result);
        assertNotNull("accessToken", profile.getAccessToken());
        assertNotNull("value", profile.getAccessToken().getValue());
        assertEquals(profile.getAccessToken().getLifetime(), populatedAccessToken.getLifetime());
        assertEquals(profile.getAccessToken().getScope(), populatedAccessToken.getScope());
        assertEquals(profile.getRefreshToken().getValue(), REFRESH_TOKEN);
        assertNull(profile.getIdTokenString());
    }
Test that serialization and deserialization of the OidcProfile work when the Id token is null.
pac4j-oidc/src/test/java/org/pac4j/oidc/profile/OidcProfileTests.java