@Test
    public void testWindowFunctionCount() {
        assertEquals(asList(5L, 5L, 5L, 5L, 5L), Seq.of(1, 2, 4, 2, 3).window().map(Window::count).toList());
        assertEquals(asList(2L, 3L, 3L, 3L, 2L), Seq.of(1, 2, 4, 2, 3).window(-1, 1).map(Window::count).toList());
        assertEquals(asList(0L, 1L, 2L, 3L, 3L), Seq.of(1, 2, 4, 2, 3).window(-3, -1).map(Window::count).toList());
        
        assertEquals(asList(2L, 3L, 3L, 3L, 2L), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2).map(Window::count).toList());
        assertEquals(asList(2L, 2L, 3L, 2L, 2L), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, -1, 1).map(Window::count).toList());
        assertEquals(asList(0L, 0L, 1L, 2L, 1L), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, -3, -1).map(Window::count).toList());
                
        assertEquals(asList(1L, 2L, 5L, 3L, 4L), Seq.of(1, 2, 4, 2, 3).window(naturalOrder()).map(Window::count).toList());
        assertEquals(asList(2L, 3L, 2L, 3L, 3L), Seq.of(1, 2, 4, 2, 3).window(naturalOrder(), -1, 1).map(Window::count).toList());
        assertEquals(asList(0L, 1L, 3L, 2L, 3L), Seq.of(1, 2, 4, 2, 3).window(naturalOrder(), -3, -1).map(Window::count).toList());
        
        assertEquals(asList(1L, 1L, 3L, 2L, 2L), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, naturalOrder()).map(Window::count).toList());
        assertEquals(asList(2L, 2L, 2L, 3L, 2L), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, naturalOrder(), -1, 1).map(Window::count).toList());
        assertEquals(asList(0L, 0L, 2L, 1L, 1L), Seq.of(1, 2, 4, 2, 3).window(i -> i % 2, naturalOrder(), -3, -1).map(Window::count).toList());
    }
@author Lukas Eder
@author Roman Tkalenko
jOOL-java-8/src/test/java/org/jooq/lambda/SeqTest.java