@Test
void groupBy() {

    final Map<Integer, List<String>> expected = new HashMap<>();
    expected.put(1, Stream.of("A", "A").collect(toList()));
    expected.put(2, Collections.singletonList("BB"));
    final Map<Integer, List<String>> actual = Stream.of("A", "BB", "A").collect(collector).toMap();
    assertEquals(expected, actual);
}