void (int[] movesAndOffsets) { DocumentEx doc = new DocumentImpl(StringUtil.repeat("blah", 1000)); List<RangeMarker> markers = new ArrayList<>(); for (int i = 0; i < movesAndOffsets.length; i+=4) { int offset = movesAndOffsets[i]; int startOffset=movesAndOffsets[i+1]; int endOffset=movesAndOffsets[i+2]; int targetOffset=movesAndOffsets[i+3]; RangeMarker marker = doc.createRangeMarker(offset, offset); markers.add(marker); moveText(doc, startOffset, endOffset, targetOffset); assertTrue(marker.toString(), marker.isValid()); for (RangeMarker rm : markers) { assertTrue(rm.isValid()); } } }