TestMixinTransformation (Grails 2.3.8)
Date: 2014-04-24

Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.compiler.injection.test
[Java] Class TestMixinTransformation

    java.lang.Object
      org.codehaus.groovy.grails.compiler.injection.test.TestMixinTransformation

All Implemented Interfaces:
  org.codehaus.groovy.transform.ASTTransformation

    @org.codehaus.groovy.transform.GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
    public class TestMixinTransformation
    extends java.lang.Object

An AST transformation to be applied to tests for adding behavior to a target test class.

Authors:
  Graeme Rocher

Since:
  2.0

Field Summary
`static org.codehaus.groovy.ast.ClassNode` | `GROOVY_OBJECT_CLASS_NODE`
`static org.codehaus.groovy.ast.AnnotationNode` | `MIXIN_METHOD_ANNOTATION`
`static java.lang.String` | `OBJECT_CLASS`
`static java.lang.String` | `SET_UP_METHOD`
`static java.lang.String` | `SPEC_CLASS`
`static java.lang.String` | `TEAR_DOWN_METHOD`
`static org.codehaus.groovy.ast.AnnotationNode` | `TEST_ANNOTATION`
`static java.lang.String` | `VOID_TYPE`

Method Summary
`static org.codehaus.groovy.ast.FieldNode` | `addFieldIfNonExistent(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode fieldType, java.lang.String fieldName)`
`protected void` | `addMethodCallsToMethod(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String name, java.util.List methods)`
`protected void` | `autoAnnotateSetupTeardown(org.codehaus.groovy.ast.ClassNode classNode)`
`protected void` | `error(org.codehaus.groovy.control.SourceUnit source, java.lang.String me)`
`protected org.codehaus.groovy.ast.expr.ListExpression` | `getListOfClasses(org.codehaus.groovy.ast.AnnotationNode node)`
`protected org.codehaus.groovy.ast.stmt.BlockStatement` | `getOrCreateMethodBody(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode setupMethod, java.lang.String name)`
`protected org.codehaus.groovy.ast.stmt.BlockStatement` | `getOrCreateNoArgsMethodBody(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String name)`
`protected boolean` | `hasAnnotation(org.codehaus.groovy.ast.MethodNode mixinMethod, java.lang.Class beforeClass)`
`protected boolean` | `hasDeclaredMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode mixinMethod)`
`static boolean` | `isAddableMethod(org.codehaus.groovy.ast.MethodNode declaredMethod)`
`protected boolean` | `isCandidateMethod(org.codehaus.groovy.ast.MethodNode declaredMethod)`
`static boolean` | `isJunit3Test(org.codehaus.groovy.ast.ClassNode classNode)`
`static boolean` | `isSpockTest(org.codehaus.groovy.ast.ClassNode classNode)`
`void` | `visit(org.codehaus.groovy.ast.ASTNode[] astNodes, org.codehaus.groovy.control.SourceUnit source)`
`void` | `weaveMixinsIntoClass(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ListExpression values)`
`void` | `weaveTestMixins(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ListExpression values)` @param classNode The class node to weave into

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), 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()

Field Detail

### GROOVY_OBJECT_CLASS_NODE

    public static final org.codehaus.groovy.ast.ClassNode GROOVY_OBJECT_CLASS_NODE

### MIXIN_METHOD_ANNOTATION

    public static final org.codehaus.groovy.ast.AnnotationNode MIXIN_METHOD_ANNOTATION

### OBJECT_CLASS

    public static final java.lang.String OBJECT_CLASS

### SET_UP_METHOD

    public static final java.lang.String SET_UP_METHOD

### SPEC_CLASS

    public static final java.lang.String SPEC_CLASS

### TEAR_DOWN_METHOD

    public static final java.lang.String TEAR_DOWN_METHOD

### TEST_ANNOTATION

    public static final org.codehaus.groovy.ast.AnnotationNode TEST_ANNOTATION

### VOID_TYPE

    public static final java.lang.String VOID_TYPE

Method Detail

### addFieldIfNonExistent

    public static org.codehaus.groovy.ast.FieldNode addFieldIfNonExistent(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ClassNode fieldType, java.lang.String fieldName)

### addMethodCallsToMethod

    protected void addMethodCallsToMethod(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String name, java.util.List methods)

### autoAnnotateSetupTeardown

    protected void autoAnnotateSetupTeardown(org.codehaus.groovy.ast.ClassNode classNode)

### error

    protected void error(org.codehaus.groovy.control.SourceUnit source, java.lang.String me)

### getListOfClasses

    protected org.codehaus.groovy.ast.expr.ListExpression getListOfClasses(org.codehaus.groovy.ast.AnnotationNode node)

### getOrCreateMethodBody

    protected org.codehaus.groovy.ast.stmt.BlockStatement getOrCreateMethodBody(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode setupMethod, java.lang.String name)

### getOrCreateNoArgsMethodBody

    protected org.codehaus.groovy.ast.stmt.BlockStatement getOrCreateNoArgsMethodBody(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String name)

### hasAnnotation

    protected boolean hasAnnotation(org.codehaus.groovy.ast.MethodNode mixinMethod, java.lang.Class beforeClass)

### hasDeclaredMethod

    protected boolean hasDeclaredMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.MethodNode mixinMethod)

### isAddableMethod

    public static boolean isAddableMethod(org.codehaus.groovy.ast.MethodNode declaredMethod)

### isCandidateMethod

    protected boolean isCandidateMethod(org.codehaus.groovy.ast.MethodNode declaredMethod)

### isJunit3Test

    public static boolean isJunit3Test(org.codehaus.groovy.ast.ClassNode classNode)

### isSpockTest

    public static boolean isSpockTest(org.codehaus.groovy.ast.ClassNode classNode)

### visit

    public void visit(org.codehaus.groovy.ast.ASTNode[] astNodes, org.codehaus.groovy.control.SourceUnit source)

### weaveMixinsIntoClass

    public void weaveMixinsIntoClass(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ListExpression values)

### weaveTestMixins

    public void weaveTestMixins(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ListExpression values)

  Parameters:
    `classNode` - The class node to weave into
    `values` - A list of ClassExpression instances

Groovy Documentation