void () { // IDEA-89874 String text = "one two three"; init(30, text); int foldStart = text.indexOf("two"); addFoldRegion(foldStart, foldStart + "two".length(), "..."); getEditor().getCaretModel().moveToOffset(foldStart + 1); FoldRegion foldRegion = getFoldRegion(foldStart); assertNotNull(foldRegion); assertTrue(foldRegion.isExpanded()); toggleFoldRegionState(foldRegion, false); assertFalse(foldRegion.isExpanded()); assertEquals(foldStart, getEditor().getCaretModel().getOffset()); }