void () { init("normal <selection><caret>line</selection>\n" + "collapsed line"); final FoldingModel foldingModel = myFixture.getEditor().getFoldingModel(); final Document document = myFixture.getEditor().getDocument(); foldingModel.runBatchFoldingOperation(() -> { FoldRegion foldRegion = foldingModel.addFoldRegion(document.getLineStartOffset(1), document.getLineEndOffset(1), "..."); assertNotNull(foldRegion); foldRegion.setExpanded(false); }); executeAction(); checkResult("normal <selection><caret>line</selection>\n" + "collapsed <selection><caret>line</selection>"); FoldRegion[] foldRegions = foldingModel.getAllFoldRegions(); assertEquals(1, foldRegions.length); assertTrue(foldRegions[0].isExpanded()); }