void () { final String text = """ 123456 123456 line towrapbecauseitislong 923456"""; init(8, text); final CaretModel caretModel = getEditor().getCaretModel(); caretModel.moveToOffset(text.indexOf("e")); final VisualPosition position = caretModel.getVisualPosition(); deleteLine(); assertEquals(text.substring(0, text.indexOf("line")) + text.substring(text.indexOf('9')), getEditor().getDocument().getText()); assertEquals(position, caretModel.getVisualPosition()); }