private Object runJUnit3TestSuite(Class scriptClass) {
        try {
            Object testSuite = InvokerHelper.invokeStaticMethod(scriptClass, "suite", new Object[]{});
            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);
        }
    }
private Object runJUnit3TestSuite ( Class scriptClass ) { try { Object testSuite = InvokerHelper . invokeStaticMethod ( scriptClass , "suite" , new Object [ ] { } ) ; 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 ) ; } }
Run the specified class extending TestSuite 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.

@param scriptClass the class to be run as a unit test