void () { myModel.runBatchFoldingOperation(() -> { myModel.addFoldRegion(0, 4, "/*...*/"); myModel.addFoldRegion(5, 9, "/*...*/"); }); assertSize(2, myModel.getAllFoldRegions()); runWriteCommand(() -> getEditor().getDocument().deleteString(0, 5)); assertSize(1, myModel.getAllFoldRegions()); }