void () { Map<ProcessOutputType, List<String>> written = new ConcurrentHashMap<>(); for (ProcessOutputType each : ALL_TYPES) { written.put(each, new ArrayList<>()); Random r = new Random(123); for (int i = 0; i < 1000; i++) { String s = StringUtil.repeat("A", 100 + r.nextInt(1000)); if (r.nextInt(2) == 1) s += "\n"; mySplitter.process(s, each); written.get(each).add(s); } } mySplitter.flush(); for (ProcessOutputType eachType : ALL_TYPES) { assertOrderedEquals(myOutput.get(eachType).toList(), written.get(eachType)); } }