void () { boolean savedValue = CodeFoldingSettings.getInstance().COLLAPSE_METHODS; try { CodeFoldingSettings.getInstance().COLLAPSE_METHODS = true; configure(""" /** class */ class C { void m() { } }""", true); int methodBodyPos = getEditor().getDocument().getText().indexOf("{\n }"); EditorTestUtil.buildInitialFoldingsInBackground(getEditor()); executeAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS); assertNotNull(getEditor().getFoldingModel().getCollapsedRegionAtOffset(methodBodyPos)); executeAction(IdeActions.ACTION_EXPAND_ALL_REGIONS); assertNull(getEditor().getFoldingModel().getCollapsedRegionAtOffset(methodBodyPos)); } finally { CodeFoldingSettings.getInstance().COLLAPSE_METHODS = savedValue; } }