Top Description Inners Fields Constructors Methods
org.apache.groovy.plugin

pack-priv final Class DefaultRunners

extends Object
Class Inheritance
Imports
groovy.lang.GroovyClassLoader, .GroovyRuntimeException, org.codehaus.groovy.runtime.InvokerHelper, java.lang.annotation.Annotation, java.lang.reflect.Method, java.util.List

Provides access to built-in GroovyRunner instances for the registry. These instances should be accessed via the registry and not used directly.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final GroovyRunner
private static final GroovyRunner
private static final GroovyRunner

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static GroovyRunner
pack-priv static GroovyRunner
pack-priv static GroovyRunner
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JUNIT3_SUITEback to summary
private static final GroovyRunner JUNIT3_SUITE
JUNIT3_TESTback to summary
private static final GroovyRunner JUNIT3_TEST
JUNIT4_TESTback to summary
private static final GroovyRunner JUNIT4_TEST

Constructor Detail

DefaultRunnersback to summary
private DefaultRunners()

Method Detail

junit3SuiteRunnerback to summary
pack-priv static GroovyRunner junit3SuiteRunner()
junit3TestRunnerback to summary
pack-priv static GroovyRunner junit3TestRunner()
junit4TestRunnerback to summary
pack-priv static GroovyRunner junit4TestRunner()
org.apache.groovy.plugin back to summary

private Class DefaultRunners.Junit3SuiteRunner

extends Object
implements GroovyRunner
Class Inheritance
All Implemented Interfaces
org.apache.groovy.plugin.GroovyRunner

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the class appears to be a test
canRun
(Class<?>
the class we want to check
scriptClass
,
GroovyClassLoader
the class loader
loader
)

Implements org.apache.groovy.plugin.GroovyRunner.canRun.

Utility method to check through reflection if the class appears to be a JUnit 3.8.x test suite, i.e. checks if it extends JUnit 3.8.x's TestSuite.
public Object
run(Class<?>
the class to be run as a unit test
scriptClass
,
GroovyClassLoader
the class loader
loader
)

Implements org.apache.groovy.plugin.GroovyRunner.run.

Run the specified class extending TestSuite as a unit test.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Junit3SuiteRunnerback to summary
private Junit3SuiteRunner()

Method Detail

canRunback to summary
public boolean canRun(Class<?> scriptClass, GroovyClassLoader loader)

Implements org.apache.groovy.plugin.GroovyRunner.canRun.

Utility method to check through reflection if the class appears to be a JUnit 3.8.x test suite, i.e. checks if it extends JUnit 3.8.x's TestSuite.

Parameters
scriptClass:Class<?>

the class we want to check

loader:GroovyClassLoader

the class loader

Returns:boolean

true if the class appears to be a test

Annotations
@Override
runback to summary
public Object run(Class<?> scriptClass, GroovyClassLoader loader)

Implements org.apache.groovy.plugin.GroovyRunner.run.

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.

Parameters
scriptClass:Class<?>

the class to be run as a unit test

loader:GroovyClassLoader

the class loader

Returns:Object

Doc from org.apache.groovy.plugin.GroovyRunner.run.

result of running the class

Annotations
@Override
org.apache.groovy.plugin back to summary

private Class DefaultRunners.Junit3TestRunner

extends Object
implements GroovyRunner
Class Inheritance
All Implemented Interfaces
org.apache.groovy.plugin.GroovyRunner

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the class appears to be a test
canRun
(Class<?>
the class we want to check
scriptClass
,
GroovyClassLoader
the class loader
loader
)

Implements org.apache.groovy.plugin.GroovyRunner.canRun.

Utility method to check through reflection if the class appears to be a JUnit 3.8.x test, i.e. checks if it extends JUnit 3.8.x's TestCase.
public Object
run(Class<?>
the class to be run as a unit test
scriptClass
,
GroovyClassLoader
the class loader
loader
)

Implements org.apache.groovy.plugin.GroovyRunner.run.

Run the specified class extending TestCase as a unit test.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Junit3TestRunnerback to summary
private Junit3TestRunner()

Method Detail

canRunback to summary
public boolean canRun(Class<?> scriptClass, GroovyClassLoader loader)

Implements org.apache.groovy.plugin.GroovyRunner.canRun.

Utility method to check through reflection if the class appears to be a JUnit 3.8.x test, i.e. checks if it extends JUnit 3.8.x's TestCase.

Parameters
scriptClass:Class<?>

the class we want to check

loader:GroovyClassLoader

the class loader

Returns:boolean

true if the class appears to be a test

Annotations
@Override
runback to summary
public Object run(Class<?> scriptClass, GroovyClassLoader loader)

Implements org.apache.groovy.plugin.GroovyRunner.run.

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.

Parameters
scriptClass:Class<?>

the class to be run as a unit test

loader:GroovyClassLoader

the class loader

Returns:Object

Doc from org.apache.groovy.plugin.GroovyRunner.run.

result of running the class

Annotations
@Override
org.apache.groovy.plugin back to summary

private Class DefaultRunners.Junit4TestRunner

extends Object
implements GroovyRunner
Class Inheritance
All Implemented Interfaces
org.apache.groovy.plugin.GroovyRunner

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the class appears to be a test
canRun
(Class<?>
the class we want to check
scriptClass
,
GroovyClassLoader
the class loader
loader
)

Implements org.apache.groovy.plugin.GroovyRunner.canRun.

Utility method to check via reflection if the parsed class appears to be a JUnit4 test, i.e. checks whether it appears to be using the relevant JUnit 4 annotations.
private static boolean
hasRunWithAnnotation(Class<?> scriptClass, ClassLoader loader)

private static boolean
hasTestAnnotatedMethod(Class<?> scriptClass, ClassLoader loader)

public Object
run(Class<?>
the class to be run as a unit test
scriptClass
,
GroovyClassLoader
the class loader
loader
)

Implements org.apache.groovy.plugin.GroovyRunner.run.

Run the specified class extending TestCase as a unit test.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Junit4TestRunnerback to summary
private Junit4TestRunner()

Method Detail

canRunback to summary
public boolean canRun(Class<?> scriptClass, GroovyClassLoader loader)

Implements org.apache.groovy.plugin.GroovyRunner.canRun.

Utility method to check via reflection if the parsed class appears to be a JUnit4 test, i.e. checks whether it appears to be using the relevant JUnit 4 annotations.

Parameters
scriptClass:Class<?>

the class we want to check

loader:GroovyClassLoader

the class loader

Returns:boolean

true if the class appears to be a test

Annotations
@Override
hasRunWithAnnotationback to summary
private static boolean hasRunWithAnnotation(Class<?> scriptClass, ClassLoader loader)
hasTestAnnotatedMethodback to summary
private static boolean hasTestAnnotatedMethod(Class<?> scriptClass, ClassLoader loader)
runback to summary
public Object run(Class<?> scriptClass, GroovyClassLoader loader)

Implements org.apache.groovy.plugin.GroovyRunner.run.

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.

Parameters
scriptClass:Class<?>

the class to be run as a unit test

loader:GroovyClassLoader

the class loader

Returns:Object

Doc from org.apache.groovy.plugin.GroovyRunner.run.

result of running the class

Annotations
@Override