void () { String text = getEditor().getDocument().getText().codePoints().mapToObj(c -> c + "\n").collect(Collectors.joining()); runWriteCommand(()-> getEditor().getDocument().setText(text)); addFoldRegion(20, 151, "1"); addFoldRegion(289, 357, "2"); addCollapsedFoldRegion(282, 357, "3"); FoldRegion[] regions = getEditor().getFoldingModel().getAllFoldRegions(); assertSize(3, regions); assertEquals(21, ((FoldingModelImpl)getEditor().getFoldingModel()).getTotalNumberOfFoldedLines()); }