void (@NotNull String text, @NotNull String ext) { myFixture.configureByText("test." + ext, text); EditorTestUtil.buildInitialFoldingsInBackground(myFixture.getEditor()); EditorFoldingInfo info = EditorFoldingInfo.get(myFixture.getEditor()); FoldRegion[] foldRegions = myFixture.getEditor().getFoldingModel().getAllFoldRegions(); assertTrue(foldRegions.length > 0); for (FoldRegion region : foldRegions) { PsiElement element = info.getPsiElement(region); if (element == null) { continue; } String signature = FoldingPolicy.getSignature(element); assertNotNull(signature); assertEquals(element, FoldingPolicy.restoreBySignature(element.getContainingFile(), signature)); } }