@groovy.util.logging.Slf4j class CompilerTestUtils extends java.lang.Object
Utility methods for testing annotations and other compiler features in unit tests. Provides a way to compile arbitrary code.
| Type | Name and description |
|---|---|
private static boolean |
printCompileFailureSourceIf set to true, then the source for the failed error is logged. |
| Constructor and description |
|---|
CompilerTestUtils
() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.lang.Class |
compileSimpleClass(java.util.Map options)Convenience method that compiles a class for testing. |
|
static java.lang.Class |
compileSource(java.lang.String src)Convenience method that compiles a given source string for testing. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
If set to true, then the source for the failed error is logged.
Convenience method that compiles a class for testing. The class is called TestClass. This method builds the boiler plate around the class contents passed in. Also sets any class level annotations.
options - The groovy source of the class contents. Everything inside of the class XYZ { . . .}.Convenience method that compiles a given source string for testing. Used for unit testing compiler logic such as annotations.
src - The groovy source.Groovy Documentation