@Test
    public void testLimitWhileClosed() {
        Supplier<Seq<Integer>> s = () -> Seq.of(1, 2, 3, 4, 5);

        assertEquals(asList(1), s.get().limitWhileClosed(i -> false).toList());
        assertEquals(asList(1, 2, 3), s.get().limitWhileClosed(i -> i % 3 != 0).toList());
        assertEquals(asList(1, 2, 3), s.get().limitWhileClosed(i -> i < 3).toList());
        assertEquals(asList(1, 2, 3, 4), s.get().limitWhileClosed(i -> i < 4).toList());
        assertEquals(asList(1, 2, 3, 4, 5), s.get().limitWhileClosed(i -> true).toList());

        verifyIteratorValidity(4, s.get(), seq -> seq.limitWhileClosed(i -> i <= 3));
    }
@author Lukas Eder
@author Roman Tkalenko
jOOL-java-8/src/test/java/org/jooq/lambda/SeqTest.java