void (EditorTextField expanded, String expected) { int offset = expanded.getEditor().getCaretModel().getOffset(); String expandedText = expanded.getText(); String expandedTextWithCaret = expandedText.substring(0, offset) + "<caret>" + expandedText.substring(offset); assertEquals(expected, expandedTextWithCaret); }