@Test
    public void testIterateWhilePresent() {
        assertThrows(NullPointerException.class, () -> Seq.iterateWhilePresent(null, i -> Optional.empty()).toList());
        assertEquals(
              asList(2),
              Seq.iterateWhilePresent(2, i -> Optional.empty()).toList()
        );
        assertEquals(
              asList(2, 4, 16, 256, 65536),
              Seq.iterateWhilePresent(2, i -> i <= 256 ? Optional.of(i * i) : Optional.empty()).toList()
        );
    }
@author Lukas Eder
@author Roman Tkalenko
jOOL-java-8/src/test/java/org/jooq/lambda/SeqTest.java