TestForTransformation (Grails 3.2.3)
Date: 2016-11-10

Package: org.grails.compiler.injection.test

## [Java] Class TestForTransformation

- org.grails.compiler.injection.test.TestForTransformation

- All Implemented Interfaces and Traits:
    TestMixinRegistry

      @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

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `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.AnnotationNode` | `TEST_ANNOTATION` |
    `static java.lang.String` | `VOID_TYPE` |
    `protected static java.util.Map<java.lang.String, java.lang.Class>` | `artefactTypeToTestMap` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class TestMixinTransformation` | `GROOVY_OBJECT_CLASS_NODE, MIXIN_METHOD_ANNOTATION, SET_UP_METHOD, SPEC_CLASS, TEAR_DOWN_METHOD, TEST_ANNOTATION, VOID_TYPE`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `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<org.codehaus.groovy.ast.expr.ClassExpression> targetClasses)`
    `protected void` | `addMockCollaborators(java.lang.String mockType, java.util.List<org.codehaus.groovy.ast.expr.ClassExpression> 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()`
    `protected void` | `handleTestForAnnotation(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.AnnotationNode testForAnnotationNode, boolean junit3Test)`
    `void` | `registerMixin(java.lang.String artefactType, java.lang.Class mixin)`
    `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)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class TestMixinTransformation` | `addJunitRuleFields, addLegacyMixinFieldIfNonExistent, addMethodCallsToMethod, addTestRuntimeAwareMixinFieldIfNonExistent, autoAnnotateSetupTeardown, error, getListOfClasses, getOrCreateMethodBody, getOrCreateNoArgsMethodBody, hasAnnotation, hasDeclaredMethod, hasSimilarMethod, isAddableMethod, isCandidateMethod, isJunit3Test, isSpockTest, shouldSkipMethod, visit, weaveMixinIntoClass, weaveMixinsIntoClass, weaveMixinsIntoClass, weaveTestMixins, weaveTestMixins`

- - ### Field Detail

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

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

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

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

    - #### public static final java.lang.String DOMAIN_TYPE

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

    - #### public static final java.lang.String VOID_TYPE

    - #### protected static final java.util.Map<java.lang.String, java.lang.Class> artefactTypeToTestMap

  - ### Method Detail

    - #### 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<org.codehaus.groovy.ast.expr.ClassExpression> targetClasses)

    - #### protected void addMockCollaborators(java.lang.String mockType, java.util.List<org.codehaus.groovy.ast.expr.ClassExpression> 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)

    - #### public ResourceLocator getResourceLocator()

    - #### protected void handleTestForAnnotation(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.AnnotationNode testForAnnotationNode, boolean junit3Test)

    - #### @java.lang.Override public void registerMixin(java.lang.String artefactType, java.lang.Class mixin)

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

    - #### @java.lang.Override public 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)