question: private static Object runJUnit3Test ( Class scriptClass ) { try { Object testSuite = InvokerHelper . invokeConstructorOf ( "junit.framework.TestSuite" , new Object [ ] { scriptClass } ) ; return InvokerHelper . invokeStaticMethod ( "junit.textui.TestRunner" , "run" , new Object [ ] { testSuite } ) ; } catch ( ClassNotFoundException e ) { throw new GroovyRuntimeException ( "Failed to run the unit test. JUnit is not on the Classpath." , e ) ; } }
target:  Run the specified class extending TestCase as a unit test. This is done through reflection, to avoid adding a dependency to the JUnit framework. Otherwise, developers embedding Groovy and using GroovyShell to load/parse/compile groovy scripts and classes would have to add another dependency on their classpath.