void (String text, String prefix, String suffix, boolean useFullTextRange, boolean filterNested, int... rangeOffsets) { assertEquals("start/end offsets not balanced", 0, rangeOffsets.length % 2); int expectedRangeCount = rangeOffsets.length / 2; List<TextRange> expectedRanges = new ArrayList<>(expectedRangeCount); for (int i = 0; i < expectedRangeCount; i++) { expectedRanges.add(new TextRange(rangeOffsets[i * 2], rangeOffsets[i * 2 + 1])); } Set<TextRange> ranges = PlaceholderTextRanges.getPlaceholderRanges(text, prefix, suffix, useFullTextRange, filterNested); assertOrderedEquals(ranges, expectedRanges); }