void () { String text = """ class Test { public void foo() { System.out.println("test"); } }"""; init(40, text); final FoldingModel foldingModel = getEditor().getFoldingModel(); assertEmpty(foldingModel.getAllFoldRegions()); final int startOffset = text.indexOf('{'); final int endOffset = text.indexOf('}') + 1; VisualPosition foldStartPosition = getEditor().offsetToVisualPosition(startOffset); addFoldRegion(startOffset, endOffset, "..."); final FoldRegion foldRegion = getFoldRegion(startOffset); assertNotNull(foldRegion); assertTrue(foldRegion.isExpanded()); toggleFoldRegionState(foldRegion, false); // Expecting that all offsets that belong to collapsed fold region point to the region's start. assertEquals(foldStartPosition, getEditor().offsetToVisualPosition(startOffset + 5)); }