ReturnNullInsteadOfBooleanCheck extends AbstractCheck { @Override public void leaveToken(DetailAST ast) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: exploreMethod = methodStack.pop(); break; case TokenTypes.LITERAL_RETURN: break; default: SevntuUtil.reportInvalidToken(ast.getType()); break; } }  @Override int[] getDefaultTokens(); @Override int[] getAcceptableTokens(); @Override int[] getRequiredTokens(); @Override void beginTree(DetailAST rootAST); @Override void visitToken(DetailAST ast); @Override void leaveToken(DetailAST ast); static final String MSG_KEY; }
@Test public void testUnsupportedNodeLeave() { final DetailAstImpl sync = new DetailAstImpl(); sync.setType(TokenTypes.LITERAL_SYNCHRONIZED); try { final ReturnNullInsteadOfBooleanCheck check = new ReturnNullInsteadOfBooleanCheck(); check.leaveToken(sync); fail("exception expected"); } catch (IllegalArgumentException ex) { Assert.assertEquals("Found unsupported token: LITERAL_SYNCHRONIZED", ex.getMessage()); } }