Caret (@NotNull EditorImpl editor, boolean makePrimary, int caretLineIndex, int caretColumnIndex, int expectedCaretPosition) { final var result = editor.getCaretModel().addCaret(new VisualPosition(caretLineIndex, caretColumnIndex), makePrimary); assertNotNull("failed to add a caret", result); assertEquals("unexpected offset of an added caret", expectedCaretPosition, result.getOffset()); return result; }