void () { @SuppressWarnings("ALL") @Language("JAVA") String text = """ class Test { void test() { //<editor-fold desc="Custom region"> System.out.println(1); System.out.println(2); //</editor-fold> System.out.println(3); }; } """; boolean oldValue = CodeFoldingSettings.getInstance().COLLAPSE_CUSTOM_FOLDING_REGIONS; try { CodeFoldingSettings.getInstance().COLLAPSE_CUSTOM_FOLDING_REGIONS = true; configure(text); FoldingModelImpl foldingModel = (FoldingModelImpl)myFixture.getEditor().getFoldingModel(); assertNotNull(foldingModel.getCollapsedRegionAtOffset(text.indexOf("//<editor-fold"))); } finally { CodeFoldingSettings.getInstance().COLLAPSE_CUSTOM_FOLDING_REGIONS = oldValue; } }