@Test public void invalidAnnotationValue() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines("test.Outer", "package test;", "", "final class Outer {", " @interface TestAnnotation {", " Class[] classes();", " }", "", " @TestAnnotation(classes = Foo)", " static class TestClass {}", "}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith( new AssertingProcessor() { @Override void runAssertions() { TypeElement testClassElement = processingEnv.getElementUtils().getTypeElement("test.Outer.TestClass"); assertWithMessage("testClassElement is valid") .that(SuperficialValidation.validateElement(testClassElement)) .isFalse(); } }) .failsToCompile(); }
public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); }
SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } }
SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private  SuperficialValidation(); }
SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private  SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateType(TypeMirror type); }
SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private  SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateType(TypeMirror type);  }