@Test
    public void testCrossApply() {
        
        Function<Integer, Seq<Integer>> f = t -> Seq.range(0, t == null ? 0 : t);
        
        // Default methods
        assertEquals(asList(),
            Seq.<Integer>of().crossApply(f).toList());
        assertEquals(asList(),
            Seq.of(0).crossApply(f).toList());
        assertEquals(asList(tuple(1, 0)),
            Seq.of(0, 1).crossApply(f).toList());
        assertEquals(asList(tuple(1, 0), tuple(2, 0), tuple(2, 1)),
            Seq.of(0, 1, 2).crossApply(f).toList());
        assertEquals(asList(tuple(1, 0), tuple(2, 0), tuple(2, 1), tuple(3, 0), tuple(3, 1), tuple(3, 2)),
            Seq.of(0, 1, 2, 3).crossApply(f).toList());
        
        // Static methods
        assertEquals(asList(),
            Seq.crossApply(Seq.of(0), f).toList());
        assertEquals(asList(tuple(1, 0)),
            Seq.crossApply(Seq.of(0, 1), f).toList());
        assertEquals(asList(tuple(1, 0), tuple(2, 0), tuple(2, 1)),
            Seq.crossApply(Seq.of(0, 1, 2), f).toList());
        assertEquals(asList(tuple(1, 0), tuple(2, 0), tuple(2, 1), tuple(3, 0), tuple(3, 1), tuple(3, 2)),
            Seq.crossApply(Seq.of(0, 1, 2, 3), f).toList());
        
        assertEquals(asList(),
            Seq.crossApply(Seq.of(0), f, f).toList());
        assertEquals(asList(),
            Seq.crossApply(Seq.of(0, 1), f, f).toList());
        assertEquals(asList(tuple(2, 1, 0)),
            Seq.crossApply(Seq.of(0, 1, 2), f, f).toList());
        assertEquals(asList(tuple(2, 1, 0), tuple(3, 1, 0), tuple(3, 2, 0), tuple(3, 2, 1)),
            Seq.crossApply(Seq.of(0, 1, 2, 3), f, f).toList());
        assertEquals(asList(tuple(2, 1, 0), tuple(3, 1, 0), tuple(3, 2, 0), tuple(3, 2, 1), tuple(4, 1, 0), tuple(4, 2, 0), tuple(4, 2, 1), tuple(4, 3, 0), tuple(4, 3, 1), tuple(4, 3, 2)),
            Seq.crossApply(Seq.of(0, 1, 2, 3, 4), f, f).toList());
        
    }
@author Lukas Eder
@author Roman Tkalenko
jOOL/src/test/java/org/jooq/lambda/SeqTest.java