TestForTransformation (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 TestForTransformation

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

    @org.codehaus.groovy.transform.GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
    @java.lang.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` | `AFTER_ANNOTATION`
`static org.codehaus.groovy.ast.ClassNode` | `AFTER_CLASS_NODE`
`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`
`static java.lang.String` | `VOID_TYPE`
`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, TEST_ANNOTATION, VOID_TYPE

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)`
`protected void` | `addMockCollaborators(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String mockType, java.util.List targetClasses)`
`protected void` | `addMockCollaborators(java.lang.String mockType, java.util.List targetClasses, org.codehaus.groovy.ast.stmt.BlockStatement methodBody)`
`protected org.codehaus.groovy.ast.stmt.Statement` | `getExistingJUnit4BeforeMethod(org.codehaus.groovy.ast.ClassNode classNode)`
`protected org.codehaus.groovy.ast.stmt.BlockStatement` | `getExistingOrCreateJUnit4Setup(org.codehaus.groovy.ast.ClassNode classNode)`
`protected java.lang.Class` | `getMixinClassForArtefactType(org.codehaus.groovy.ast.ClassNode classNode)`
`protected org.codehaus.groovy.ast.stmt.BlockStatement` | `getOrCreateTestSetupMethod(org.codehaus.groovy.ast.ClassNode classNode)`
`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
addFieldIfNonExistent, addMethodCallsToMethod, autoAnnotateSetupTeardown, error, getListOfClasses, getOrCreateMethodBody, getOrCreateNoArgsMethodBody, hasAnnotation, hasDeclaredMethod, isAddableMethod, isCandidateMethod, isJunit3Test, isSpockTest, visit, weaveMixinsIntoClass, weaveTestMixins

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

### AFTER_ANNOTATION

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

### AFTER_CLASS_NODE

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

### 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

### VOID_TYPE

    public static final java.lang.String VOID_TYPE

### 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)

### addMockCollaborators

    protected void addMockCollaborators(org.codehaus.groovy.ast.ClassNode classNode, java.lang.String mockType, java.util.List targetClasses)

### addMockCollaborators

    protected void addMockCollaborators(java.lang.String mockType, java.util.List targetClasses, org.codehaus.groovy.ast.stmt.BlockStatement methodBody)

### getExistingJUnit4BeforeMethod

    protected org.codehaus.groovy.ast.stmt.Statement getExistingJUnit4BeforeMethod(org.codehaus.groovy.ast.ClassNode classNode)

### getExistingOrCreateJUnit4Setup

    protected org.codehaus.groovy.ast.stmt.BlockStatement getExistingOrCreateJUnit4Setup(org.codehaus.groovy.ast.ClassNode classNode)

### getMixinClassForArtefactType

    protected java.lang.Class getMixinClassForArtefactType(org.codehaus.groovy.ast.ClassNode classNode)

### getOrCreateTestSetupMethod

    protected org.codehaus.groovy.ast.stmt.BlockStatement getOrCreateTestSetupMethod(org.codehaus.groovy.ast.ClassNode classNode)

### 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

    @java.lang.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