void (Segment[] highlighters, String... expected) { String[] actual = Arrays.stream(highlighters) .sorted(Comparator.comparingInt(Segment::getStartOffset)) .map(it -> it.getStartOffset() + ":" + it.getEndOffset() + " " + getFile().getText().substring(it.getStartOffset(), it.getEndOffset())) .toArray(String[]::new); assertSameElements(actual, expected); }