void () { addFoldRegion(10, 20, "1"); addFoldRegion(15, 20, "2"); addFoldRegion(16, 17, "3"); WriteAction.run(() -> getEditor().getDocument().deleteString(10, 15)); FoldRegion[] regions = getEditor().getFoldingModel().getAllFoldRegions(); assertSize(2, regions); assertEquals(TextRange.create(10, 15), regions[0].getTextRange()); assertEquals(TextRange.create(11, 12), regions[1].getTextRange()); }