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.getEditor().getCaretModel().moveToOffset(text.indexOf("run")); myFixture.performEditorAction(IdeActions.ACTION_COLLAPSE_REGION); myFixture.getEditor().getCaretModel().moveToOffset(text.indexOf("new")); myFixture.performEditorAction(IdeActions.ACTION_COLLAPSE_REGION); assertEquals(1, getExpandedFoldRegionsCount()); myFixture.getEditor().getCaretModel().moveToOffset(text.indexOf("main")); myFixture.performEditorAction(IdeActions.ACTION_EXPAND_REGION_RECURSIVELY); assertEquals(3, getExpandedFoldRegionsCount()); }