void () { Editor editor = initDocument(""" class C { void foo() { first(); second(); } }"""); WriteCommandAction.runWriteCommandAction(getProject(), () -> { myDocument.insertString(myDocument.getText().lastIndexOf("first"), "'''"); myDocument.insertString(myDocument.getText().lastIndexOf("second"), " "); }); CheckHighlighterConsistency.performCheck(editor); }