void () { // Inspired by IDEA-61275 String text = """ /** * This is a test comment */ public <caret>class Test { }"""; init(text, JavaFileType.INSTANCE); CaretModel caretModel = getEditor().getCaretModel(); int caretOffset = caretModel.getOffset(); assertEquals(caretOffset, caretModel.getOffset()); updateFoldRegions(); toggleFoldRegionState(getFoldRegion(0), false); type('a'); updateFoldRegions(); assertEquals(caretOffset + 1, caretModel.getOffset()); assertEquals(1, getEditor().getFoldingModel().getAllFoldRegions().length); FoldRegion foldRegion = getFoldRegion(0); assertFalse(foldRegion.isExpanded()); }