void () { @SuppressWarnings("ALL") @Language("JAVA") String text = """ class Foo { void m() { if (true) { System.out.println(); } } }"""; configure(text); myFixture.getEditor().getCaretModel().moveToOffset(text.indexOf("System")); myFixture.performEditorAction("CollapseBlock"); myFixture.performEditorAction("ExpandAllRegions"); myFixture.getEditor().getCaretModel().moveToOffset(text.indexOf("System")); myFixture.performEditorAction("CollapseBlock"); FoldRegion[] topLevelRegions = ((FoldingModelEx)myFixture.getEditor().getFoldingModel()).fetchTopLevel(); assertEquals(1, topLevelRegions.length); assertEquals(topLevelRegions[0].getStartOffset(), text.indexOf("{", text.indexOf("if"))); assertEquals(topLevelRegions[0].getEndOffset(), text.indexOf("}", text.indexOf("if")) + 1); }