Groovy Documentation

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

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

@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
@SuppressWarnings("rawtypes")
public class TestForTransformation
extends TestMixinTransformation

Transformation used by the TestFor annotation to signify the class under test.

Authors:
Graeme Rocher
Since:
2.0


Field Summary
static org.codehaus.groovy.ast.AnnotationNode BEFORE_ANNOTATION

static org.codehaus.groovy.ast.ClassNode BEFORE_CLASS_NODE

static java.lang.String DOMAIN_TYPE

static org.codehaus.groovy.ast.ClassNode GROOVY_TEST_CASE_CLASS

static org.codehaus.groovy.ast.AnnotationNode TEST_ANNOTATION

protected static java.util.Map artefactTypeToTestMap

 
Fields inherited from class TestMixinTransformation
GROOVY_OBJECT_CLASS_NODE, MIXIN_METHOD_ANNOTATION, OBJECT_CLASS, SET_UP_METHOD, SPEC_CLASS, TEAR_DOWN_METHOD, THIS_EXPRESSION
 
Method Summary
protected org.codehaus.groovy.ast.MethodNode addClassUnderTestMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClassExpression targetClass, java.lang.String type)

protected void addMockCollaborator(java.lang.String mockType, org.codehaus.groovy.ast.expr.ClassExpression targetClass, org.codehaus.groovy.ast.stmt.BlockStatement methodBody)

ResourceLocator getResourceLocator()

void testFor(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClassExpression ce)

Main entry point for the calling the TestForTransformation programmatically.

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

protected void weaveMixinClass(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class mixinClass)

protected org.codehaus.groovy.ast.MethodNode weaveMock(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClassExpression value, boolean isClassUnderTest)

 
Methods inherited from class TestMixinTransformation
addMethodCallsToMethod, error, getListOfClasses, getOrCreateMethodBody, getOrCreateNoArgsMethodBody, hasAnnotation, hasDeclaredMethod, isAddableMethod, isCandidateMethod, isJunit3Test, isSpockTest, visit, weaveMixinsIntoClass
 
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

BEFORE_ANNOTATION

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


BEFORE_CLASS_NODE

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


DOMAIN_TYPE

public static final java.lang.String DOMAIN_TYPE


GROOVY_TEST_CASE_CLASS

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


TEST_ANNOTATION

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


artefactTypeToTestMap

protected static final java.util.Map artefactTypeToTestMap


 
Method Detail

addClassUnderTestMethod

protected org.codehaus.groovy.ast.MethodNode addClassUnderTestMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClassExpression targetClass, java.lang.String type)


addMockCollaborator

protected void addMockCollaborator(java.lang.String mockType, org.codehaus.groovy.ast.expr.ClassExpression targetClass, org.codehaus.groovy.ast.stmt.BlockStatement methodBody)


getResourceLocator

public ResourceLocator getResourceLocator()


testFor

public void testFor(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClassExpression ce)
Main entry point for the calling the TestForTransformation programmatically.
Parameters:
classNode - The class node that represents th test
ce - The class expression that represents the class to test


visit

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


weaveMixinClass

protected void weaveMixinClass(org.codehaus.groovy.ast.ClassNode classNode, java.lang.Class mixinClass)


weaveMock

protected org.codehaus.groovy.ast.MethodNode weaveMock(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClassExpression value, boolean isClassUnderTest)


 

Groovy Documentation