Groovy Documentation

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

@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.expr.VariableExpression THIS_EXPRESSION

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

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)

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


THIS_EXPRESSION

public static final org.codehaus.groovy.ast.expr.VariableExpression THIS_EXPRESSION


 
Method Detail

addMethodCallsToMethod

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


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)


 

Groovy Documentation