@Test
    public void testGetAllTwoProfilesOneExpiredRemoved() {
        CommonProfile expiredProfile = mock(CommonProfile.class);
        when(expiredProfile.getClientName()).thenReturn(CLIENT1);
        when(expiredProfile.isExpired()).thenReturn(true);

        CommonProfile renewedProfile = new CommonProfile();

        profiles.put(CLIENT1, expiredProfile);
        profiles.put(CLIENT2, profile2);
        sessionStore.set(context, Pac4jConstants.USER_PROFILES, profiles);

        val client1 = mock(BaseClient.class);
        when(client1.getName()).thenReturn(CLIENT1);
        when(client1.renewUserProfile(any(),eq(expiredProfile))).thenReturn(Optional.of(renewedProfile));
        profileManager.setConfig(new Config(client1));

        final List<UserProfile> retrievedProfiles = profileManager.getProfiles();

        assertEquals(2,retrievedProfiles.size());
        assertSame(renewedProfile,retrievedProfiles.get(0));
        assertSame(profile2, retrievedProfiles.get(1));
    }
Tests {@link ProfileManager}.

@author Jerome Leleu
@since 1.9.0
pac4j-core/src/test/java/org/pac4j/core/profile/ProfileManagerTests.java