Source:
<code>public final void visitClass(ClassTree tree) { <START> if (tree.simpleName().name().endsWith("TestSuite")) { <END> final AnnotationTree runWithAnnotation = Iterables.find(tree.modifiers().annotations(), ClassParserUtils.hasAnnotationPredicate(SuiteClasses.class), null); if (runWithAnnotation == null) { logAndRaiseIssue(tree, String.format("Missing @SuiteClasses annotation on Test Suite class '%s'.", tree.simpleName().name())); } else { final List<ExpressionTree> arguments = runWithAnnotation.arguments(); final NewArrayTreeImpl arrayTree = (NewArrayTreeImpl) Iterables.getOnlyElement(arguments); InitializerListTreeImpl suiteClasses = (InitializerListTreeImpl) arrayTree.initializers(); if (suiteClasses.isEmpty()) { logAndRaiseIssue(tree, "No tests have been declared under @SuiteClasses."); } else { File dir = new File(TEST_DIR); final List<File> tests = (List<File>) FileUtils.listFiles(dir, new WildcardFileFilter("*TestCases.java"), TrueFileFilter.INSTANCE); for (ExpressionTree test : suiteClasses) { String testName = ((MemberSelectExpressionTree) test).expression().symbolType().name(); Iterable<? extends File> matchingTests = Iterables.filter(tests, new FilePredicate(testName)); if (testName.endsWith(SUFFIX)) { if (Iterables.isEmpty(matchingTests)) { logAndRaiseIssue(tree, String.format("A file named '%s.java' must exist in directory 'src/test/java/../automation/functional'. ", testName)); } } else { logAndRaiseIssue(tree, String.format("Functional tests must end with 'TestCases'. Rename test '%s' accordingly.", testName)); } } } } } super.visitClass(tree); }</code><technical_language>Method invocation 'tree.simpleName().name()' produce 'java.lang.NullPointerException'</technical_language>

Target:
public final void visitClass(ClassTree tree) { IdentifierTree treeName = tree.simpleName(); if (treeName != null && treeName.name().endsWith("TestSuite")) { final AnnotationTree runWithAnnotation = Iterables.find(tree.modifiers().annotations(), ClassParserUtils.hasAnnotationPredicate(SuiteClasses.class), null); if (runWithAnnotation == null) { logAndRaiseIssue(tree, String.format("Missing @SuiteClasses annotation on Test Suite class '%s'.", tree.simpleName().name())); } else { final List<ExpressionTree> arguments = runWithAnnotation.arguments(); final NewArrayTreeImpl arrayTree = (NewArrayTreeImpl) Iterables.getOnlyElement(arguments); InitializerListTreeImpl suiteClasses = (InitializerListTreeImpl) arrayTree.initializers(); if (suiteClasses.isEmpty()) { logAndRaiseIssue(tree, "No tests have been declared under @SuiteClasses."); } else { final List<File> tests = (List<File>) FileUtils.listFiles(new File(TEST_DIR), new WildcardFileFilter("*TestCases.java"), TrueFileFilter.INSTANCE); for (ExpressionTree test : suiteClasses) { String testName = ((MemberSelectExpressionTree) test).expression().symbolType().name(); Iterable<? extends File> matchingTests = Iterables.filter(tests, new FilePredicate(testName)); if (testName.endsWith(SUFFIX)) { if (Iterables.isEmpty(matchingTests)) { logAndRaiseIssue(test, String.format("A file named '%s.java' must exist in directory 'src/test/java/../automation/functional'.", testName)); } } else { logAndRaiseIssue(test, String.format("Functional test classes must end with 'TestCases'. Rename '%s.java' accordingly.", testName)); } } } } } super.visitClass(tree); }