void () { @SuppressWarnings("ALL") @Language("JAVA") String text = """ class Foo { public static void main() { new Runnable(){ public void run() { } }.run(); } }"""; configure(text); assertEquals(3, getFoldRegionsCount()); myFixture.performEditorAction(IdeActions.ACTION_EXPAND_ALL_REGIONS); assertEquals(3, getExpandedFoldRegionsCount()); myFixture.getEditor().getSelectionModel().setSelection(text.indexOf("new"), text.indexOf("run();")); myFixture.performEditorAction(IdeActions.ACTION_COLLAPSE_ALL_REGIONS); assertEquals(1, getExpandedFoldRegionsCount()); myFixture.performEditorAction(IdeActions.ACTION_EXPAND_ALL_REGIONS); assertEquals(3, getExpandedFoldRegionsCount()); }