protected void failLoop(final int trials, final int period, final int expected) throws Exception {
        /* Seed with something to compare against */

        login("mog", "badpassword", IP_ADDRESS);

        IntStream.range(0, trials).forEach(Unchecked.intConsumer(i -> {
            Thread.sleep(period);
            val status = login("mog", "badpassword", IP_ADDRESS);
            if (i == trials) {
                assertEquals(expected, status.getStatus());
            }
        }));
    }
Base class for submission throttle tests.

@author Marvin S. Addison
@since 3.0.0
support/cas-server-support-throttle/src/test/java/org/apereo/cas/web/support/BaseThrottledSubmissionHandlerInterceptorAdapterTests.java