@Test
    public void testGroupedSameBehaviorAsGroupBy() throws Exception {
        Random r = new Random(System.nanoTime());
        int runs = r.nextInt(127) + 1;
        for (int i = 0; i < runs; i++) {
            int mod = r.nextInt(125) + 2;
            List<Long> longs = r.longs().limit(1024).boxed().collect(toList());
            Map<Long, List<Long>> newMethod = Seq.seq(longs).grouped(x -> x % mod).toMap(t -> t.v1, t -> t.v2.toList());
            Map<Long, List<Long>> libMethod = longs.stream().collect(groupingBy(x -> x % mod));
            assertEquals(libMethod, newMethod);
        }
    }
@author Lukas Eder
@author Roman Tkalenko
jOOL-java-8/src/test/java/org/jooq/lambda/SeqTest.java