@Test
    public void testInitCalledOnlyOnce() {
        var io = new CustomInitializableObject(false);
        assertEquals(0, io.getCounter());
        assertEquals(0, io.getNbAttempts());
        assertNull(io.getLastAttempt());

        io.init();
        assertEquals(1, io.getCounter());
        assertEquals(1, io.getNbAttempts());
        assertNotNull(io.getLastAttempt());

        io.init();
        assertEquals(1, io.getCounter());
        assertEquals(1, io.getNbAttempts());
        assertNotNull(io.getLastAttempt());
    }
This class tests the {@link InitializableObject} class.

@author Jerome Leleu
@since 1.4.0
pac4j-core/src/test/java/org/pac4j/core/util/InitializableObjectTests.java