@Test public void testTokensNotNull() { final DeclarationOrderCheck check = new DeclarationOrderCheck(); Assert.assertNotNull(check.getAcceptableTokens()); Assert.assertNotNull(check.getDefaultTokens()); Assert.assertNotNull(check.getRequiredTokens()); }
@Test public void testImproperToken() { final DetailAST parent = new DetailAST(); parent.setType(TokenTypes.STATIC_INIT); final DetailAST array = new DetailAST(); array.setType(TokenTypes.ARRAY_INIT); parent.setFirstChild(array); final DeclarationOrderCheck check = new DeclarationOrderCheck(); check.visitToken(array); }
@Test public void testParents() { final DetailAST parent = new DetailAST(); parent.setType(TokenTypes.STATIC_INIT); final DetailAST method = new DetailAST(); method.setType(TokenTypes.METHOD_DEF); parent.setFirstChild(method); final DetailAST ctor = new DetailAST(); ctor.setType(TokenTypes.CTOR_DEF); method.setNextSibling(ctor); final DeclarationOrderCheck check = new DeclarationOrderCheck(); check.visitToken(method); check.visitToken(ctor); }