void () { WriteCommandAction.runWriteCommandAction(null, () -> { final String text1 = "c/** * co *"; String text = text1 + "class"; initDocument(text); myDocument.insertString(text1.length(), "/"); final HighlighterIterator iterator = myHighlighter.createIterator(text1.length() + 1); assertEquals(JavaTokenType.CLASS_KEYWORD, iterator.getTokenType()); myDocument.deleteString(text1.length(), text1.length() + 1); }); }