use of com.puppycrawl.tools.checkstyle.api.LocalizedMessages in project checkstyle by checkstyle.
the class IllegalInstantiationCheckTest method testNullClassLoader.
@Test
public void testNullClassLoader() throws Exception {
final DetailAST exprAst = new DetailAST();
exprAst.setType(TokenTypes.EXPR);
final DetailAST newAst = new DetailAST();
newAst.setType(TokenTypes.LITERAL_NEW);
newAst.setLineNo(1);
newAst.setColumnNo(1);
final DetailAST identAst = new DetailAST();
identAst.setType(TokenTypes.IDENT);
identAst.setText("Boolean");
final DetailAST lparenAst = new DetailAST();
lparenAst.setType(TokenTypes.LPAREN);
final DetailAST elistAst = new DetailAST();
elistAst.setType(TokenTypes.ELIST);
final DetailAST rparenAst = new DetailAST();
rparenAst.setType(TokenTypes.RPAREN);
exprAst.addChild(newAst);
newAst.addChild(identAst);
identAst.setNextSibling(lparenAst);
lparenAst.setNextSibling(elistAst);
elistAst.setNextSibling(rparenAst);
final IllegalInstantiationCheck check = new IllegalInstantiationCheck();
final File inputFile = new File(getNonCompilablePath("InputIllegalInstantiationLang.java"));
check.setFileContents(new FileContents(new FileText(inputFile, "UTF-8")));
check.configure(createCheckConfig(IllegalInstantiationCheck.class));
check.setMessages(new LocalizedMessages());
check.setClasses("java.lang.Boolean");
check.visitToken(newAst);
check.finishTree(newAst);
}
Aggregations