void (String testData) { StringBuilder line = new StringBuilder(testData); List<TextRange> expectedRanges = new ArrayList<>(); int last = 0; while (last < line.length()) { int start = line.indexOf(START_MARKER, last); if (start == -1) break; int end = line.indexOf(END_MARKER, start); if (end == -1) break; end -= START_MARKER.length(); line.delete(start, start + START_MARKER.length()); line.delete(end, end + END_MARKER.length()); expectedRanges.add(new TextRange(start, end)); last = end; } GitConsoleFolding provider = new GitConsoleFolding(); List<VcsConsoleFolding.Placeholder> foldings = provider.getFoldingsForLine(getProject(), line.toString()); assertEquals(expectedRanges.size(), foldings.size()); for (int i = 0; i < foldings.size(); i++) { TextRange expected = expectedRanges.get(i); TextRange actual = foldings.get(i).getTextRange(); assertEquals(expected, actual); } }