@Test
    public void testWindowFunctionLead() {
        assertEquals(optional(2, 4, 2, 3, null), Seq.of(1, 2, 4, 2, 3).window().map(Window::lead).toList());
        assertEquals(optional(3, 4, 2, null, null), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2).map(Window::lead).toList());
        
        assertEquals(optional(2, 2, null, 3, 4), Seq.of(1, 2, 4, 2, 3).window(naturalOrder()).map(Window::lead).toList());
        assertEquals(optional(3, 2, null, 4, null), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, naturalOrder()).map(Window::lead).toList());
        
        
        assertEquals(optional(4, 2, 3, null, null), Seq.of(1, 2, 4, 2, 3).window().map(w -> w.lead(2)).toList());
        assertEquals(optional(null, 2, null, null, null), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2).map(w -> w.lead(2)).toList());
        
        assertEquals(optional(2, 3, null, 4, null), Seq.of(1, 2, 4, 2, 3).window(naturalOrder()).map(w -> w.lead(2)).toList());
        assertEquals(optional(null, 4, null, null, null), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, naturalOrder()).map(w -> w.lead(2)).toList());
    }
@author Lukas Eder
@author Roman Tkalenko
jOOL-java-8/src/test/java/org/jooq/lambda/SeqTest.java