home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (MainIntegrationTest.groovy)

This example Groovy source code file (MainIntegrationTest.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

ast, ast, groovytestcase, mainintegrationtest, mainintegrationtest, maintransformation, maintransformation, transformtesthelper, transformtesthelper

The Groovy MainIntegrationTest.groovy source code

package examples.astbuilder

import org.codehaus.groovy.tools.ast.TransformTestHelper
import org.codehaus.groovy.control.CompilePhase

 * This TestCase shows how to invoke an AST Transformation from a unit test.
 * An IDE will let you step through the AST Transformation using this approach. 
 * @author Hamlet D'Arcy

class MainIntegrationTest extends GroovyTestCase {

     public void testInvokeUnitTest() {
        def invoker = new TransformTestHelper(new MainTransformation(), CompilePhase.CANONICALIZATION)

        def file = new File('./MainExample.groovy')
        assert file.exists()

        def clazz = invoker.parse(file)
        def tester = clazz.newInstance()
        tester.main(null)       // main method added with AST transform

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy MainIntegrationTest.groovy source code file:

new blog posts


Copyright 1998-2014 Alvin Alexander, alvinalexander.com
All Rights Reserved.