void (int n) { FoldingModel foldingModel = myFixture.getEditor().getFoldingModel(); final FoldRegion foldRegion = foldingModel.getAllFoldRegions()[n]; foldingModel.runBatchFoldingOperation(() -> foldRegion.setExpanded(false)); }