StaticMethodCandidateCheck extends AbstractCheck { @Override public int[] getAcceptableTokens() { return new int[] { TokenTypes.CLASS_DEF, TokenTypes.METHOD_DEF, TokenTypes.LITERAL_IF, TokenTypes.LITERAL_FOR, TokenTypes.LITERAL_WHILE, TokenTypes.LITERAL_DO, TokenTypes.LITERAL_CATCH, TokenTypes.LITERAL_TRY, TokenTypes.VARIABLE_DEF, TokenTypes.PARAMETER_DEF, TokenTypes.ENUM_DEF, TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.EXPR, TokenTypes.STATIC_INIT, TokenTypes.INSTANCE_INIT, TokenTypes.LITERAL_NEW, TokenTypes.LITERAL_THIS, TokenTypes.CTOR_DEF, TokenTypes.TYPE, TokenTypes.TYPE_ARGUMENT, TokenTypes.TYPE_PARAMETER, TokenTypes.INTERFACE_DEF, TokenTypes.LITERAL_SUPER, }; }  void setSkippedMethods(String skippedMethods); @Override int[] getAcceptableTokens(); @Override int[] getDefaultTokens(); @Override int[] getRequiredTokens(); @Override void beginTree(DetailAST rootAST); @Override void visitToken(final DetailAST ast); @Override void leaveToken(DetailAST ast); @Override void finishTree(DetailAST ast); static final String MSG_KEY; }
@Test public void testGetAcceptableTokens() { final int[] expected = { TokenTypes.CLASS_DEF, TokenTypes.METHOD_DEF, TokenTypes.LITERAL_IF, TokenTypes.LITERAL_FOR, TokenTypes.LITERAL_WHILE, TokenTypes.LITERAL_DO, TokenTypes.LITERAL_CATCH, TokenTypes.LITERAL_TRY, TokenTypes.VARIABLE_DEF, TokenTypes.PARAMETER_DEF, TokenTypes.ENUM_DEF, TokenTypes.ENUM_CONSTANT_DEF, TokenTypes.EXPR, TokenTypes.STATIC_INIT, TokenTypes.INSTANCE_INIT, TokenTypes.LITERAL_NEW, TokenTypes.LITERAL_THIS, TokenTypes.CTOR_DEF, TokenTypes.TYPE, TokenTypes.TYPE_ARGUMENT, TokenTypes.TYPE_PARAMETER, TokenTypes.INTERFACE_DEF, TokenTypes.LITERAL_SUPER, }; final StaticMethodCandidateCheck check = new StaticMethodCandidateCheck(); assertArrayEquals("invalid tokens", expected, check.getAcceptableTokens()); }