void () { List<Pair<String, Key<String>>> expected = List.of( new Pair<>("[", Key.create("color1")), new Pair<>("INFO", Key.create("color2")), new Pair<>("]\n", Key.create("color1")) ); List<Pair<String, Key<String>>> actual = new ArrayList<>(); MavenSimpleConsoleEventsBuffer buffer = new MavenSimpleConsoleEventsBuffer((l, k) -> actual.add(new Pair<>(l, k)), false); for (var item : expected) { buffer.addText(item.first, item.second); } assertEquals(expected, actual); }