void () { final int totalInvocationCount = 42; final int skipCount = 5; final int expectedInvocations = totalInvocationCount / skipCount; final AtomicInteger operationInvocations = new AtomicInteger(0); final Runnable operation = Utils.asCountedRunnable(skipCount, operationInvocations::incrementAndGet); for (int i = 0; i < totalInvocationCount; i++) { operation.run(); } assertEquals(expectedInvocations, operationInvocations.get()); }