Class AbstractProcessorTest
- java.lang.Object
-
- org.uberfire.annotations.processors.AbstractProcessorTest
-
public abstract class AbstractProcessorTest extends Object
Base miscfeatures to generate source code with an Annotation Processor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractProcessorTest.ResultContainer for miscfeatures results.
-
Constructor Summary
Constructors Constructor Description AbstractProcessorTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidassertCompilationMessage(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.voidassertFailedCompilation(List<Diagnostic<? extends JavaFileObject>> diagnostics)Assert that compilation failedvoidassertSuccessfulCompilation(List<Diagnostic<? extends JavaFileObject>> diagnostics)Assert that compilation was successfulList<Diagnostic<? extends JavaFileObject>>compile(Processor annotationProcessor, String... compilationUnits)Compile a unit of source code with the specified annotation processorStringgetExpectedSourceCode(String compilationUnit)Retrieve the expected source code for a compilation unitprotected abstract org.uberfire.annotations.processors.AbstractErrorAbsorbingProcessorgetProcessorUnderTest()Returns the annotation processor being tested by the current test.voidshouldNotAllowClassNotFoundExceptionThrough()Regression test for UF-44: Annotation Processors can put eclipse into an infinite loop.
-
-
-
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:
-
getExpectedSourceCode
public String getExpectedSourceCode(String compilationUnit) throws FileNotFoundException
Retrieve the expected source code for a compilation unit- Parameters:
compilationUnit-- Returns:
- Throws:
FileNotFoundException
-
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, orDiagnostic.NOPOSif line number is not important.col- the column number that must be attached to the message, orDiagnostic.NOPOSif 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.
-
-