void (@NotNull String before, @NotNull String expected) { String typeChar = before.charAt(0) == '"' ? "'" : "\""; StringBuilder selectFirst = new StringBuilder(before).insert(1, "</selection>").insert(0, "<selection><caret>"); StringBuilder expectedFirst = new StringBuilder(expected).insert(1, "<caret>"); doTest(typeChar, selectFirst.toString(), expectedFirst.toString()); StringBuilder selectLast = new StringBuilder(before).insert(before.length() - 1, "<selection><caret>").append("</selection>"); doTest(typeChar, selectLast.toString(), expected + "<caret>"); }