Class AbstractProcessorTest


  • public abstract class AbstractProcessorTest
    extends Object
    Base miscfeatures to generate source code with an Annotation Processor
    • Constructor Detail

      • AbstractProcessorTest

        public AbstractProcessorTest()
    • Method Detail

      • compile

        public List<Diagnostic<? extends JavaFileObject>> compile​(Processor annotationProcessor,
                                                                  String... compilationUnits)
        Compile a unit of source code with the specified annotation processor
        Parameters:
        annotationProcessor -
        compilationUnits -
        Returns:
      • assertSuccessfulCompilation

        public void assertSuccessfulCompilation​(List<Diagnostic<? extends JavaFileObject>> diagnostics)
        Assert that compilation was successful
        Parameters:
        diagnostics -
      • assertFailedCompilation

        public void assertFailedCompilation​(List<Diagnostic<? extends JavaFileObject>> diagnostics)
        Assert that compilation failed
        Parameters:
        diagnostics -
      • assertCompilationMessage

        public void assertCompilationMessage​(List<Diagnostic<? extends JavaFileObject>> diagnostics,
                                             Diagnostic.Kind kind,
                                             long line,
                                             long col,
                                             String message)
        Assert that the given error message is contained in the compilation diagnostics.
        Parameters:
        diagnostics - the list of diagnostic messages from the compiler. Must not be null.
        kind - the kind of message to search for, or null to search messages of any kind.
        line - the line number that must be attached to the message, or Diagnostic.NOPOS if line number is not important.
        col - the column number that must be attached to the message, or Diagnostic.NOPOS if column number is not important.
        message - the message to search for. If any otherwise matching message in the given list contains this string, the assertion passes. Must not be null.
      • getProcessorUnderTest

        protected abstract org.uberfire.annotations.processors.AbstractErrorAbsorbingProcessor getProcessorUnderTest()
        Returns the annotation processor being tested by the current test. This processor should be created with a GenerationCompleteCallback that will capture the output of the processor so it can be examined by test assertions.
      • shouldNotAllowClassNotFoundExceptionThrough

        public void shouldNotAllowClassNotFoundExceptionThrough()
                                                         throws Exception
        Regression test for UF-44: Annotation Processors can put eclipse into an infinite loop.
        Throws:
        Exception