void () { addCollapsedFoldRegion(10, 15, "..."); addCollapsedFoldRegion(10, 14, "..."); runWriteCommand(() -> getEditor().getDocument().deleteString(14, 15)); FoldRegion region = myModel.getCollapsedRegionAtOffset(10); assertNotNull(region); assertTrue(region.isValid()); assertEquals(10, region.getStartOffset()); assertEquals(14, region.getEndOffset()); addFoldRegion(0, 1, "..."); FoldRegion region2 = myModel.getCollapsedRegionAtOffset(10); assertNotNull(region2); assertTrue(region2.isValid()); assertEquals(10, region2.getStartOffset()); assertEquals(14, region2.getEndOffset()); assertSame(region, region2); }