void () { myFoldingSettings.setCollapseLambdas(true); @SuppressWarnings("ALL") @Language("JAVA") String text = """ public abstract class AroundTemplateMethod<T> { public abstract T execute(); } abstract class SetupTimer<T> extends AroundTemplateMethod<T> { } class Test { void test() { new SetupTimer<Integer>() { public Integer execute() { return 0; } }; } }"""; configure(text); FoldingModelImpl foldingModel = (FoldingModelImpl)myFixture.getEditor().getFoldingModel(); FoldRegion closureStartFold = foldingModel.getCollapsedRegionAtOffset(text.indexOf("<Integer>")); assertNotNull(closureStartFold); assertFalse(closureStartFold.isExpanded()); assertNotNull(closureStartFold.getGroup()); List<FoldRegion> closureFolds = foldingModel.getGroupedRegions(closureStartFold.getGroup()); assertNotNull(closureFolds); assertEquals(2, closureFolds.size()); }