@Test
    public void testSetState() throws MalformedURLException {
        var client = new FacebookClient(KEY, SECRET);
        client.setCallbackUrl(CALLBACK_URL);
        client.getConfiguration().setStateGenerator(new StaticValueGenerator("oldstate"));
        val mockWebContext = MockWebContext.create();
        var action = (FoundAction) client.getRedirectionAction(
            new CallContext(mockWebContext, new MockSessionStore())).get();
        var url = new URL(action.getLocation());
        val stringMap = TestsHelper.splitQuery(url);
        assertEquals(stringMap.get("state"), "oldstate");
        action = (FoundAction) client.getRedirectionAction(
            new CallContext(mockWebContext, new MockSessionStore())).get();
        var url2 = new URL(action.getLocation());
        val stringMap2 = TestsHelper.splitQuery(url2);
        assertEquals(stringMap2.get("state"), "oldstate");
    }
This class tests the {@link OAuth20Client} class.

@author Jerome Leleu
@since 1.0.0
pac4j-oauth/src/test/java/org/pac4j/oauth/client/OAuth20ClientTests.java