|
Groovy example source code file (MainIntegrationTest.groovy)
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: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.