void () { myBuilder = createBuilder("foo"); myBuilder.setDebugMode(true); final PsiBuilder.Marker m = myBuilder.mark(); m.done(JavaTokenType.PACKAGE_KEYWORD); try { myBuilder.getTreeBuilt(); fail("Assertion must fire"); } catch (AssertionFailedError e) { throw e; } catch (Throwable e) { if (!e.getMessage().startsWith("Tokens [IDENTIFIER] were not inserted into the tree")) { fail("Wrong assertion message"); } } }