org.callbackparams.junit4
Class EnumRunner
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.BlockJUnit4ClassRunner>
org.callbackparams.junit4.EnumRunner
- All Implemented Interfaces:
- org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable
public class EnumRunner
- extends org.junit.runners.ParentRunner<org.junit.runners.BlockJUnit4ClassRunner>
The very simpliest use-case for callback-params is when the parameters are
self-contained, i.e. they have at least one regular JUnit4 test-method
(takes zero arguments) which can perform its test all on its own without
input from any containing callback-params test-method. For this case it
could be over-kill to have the parameters go the detour
through some customized CallbackParams test-class. However, by using this
test-runner class for the enum that provides these parameters it is possible
to run the self-contained test-methods without writing any additional code.
It is not absolutly mandatory for the test-class to be an enum. - The
important thing is that it has a static method "values()" that returns the
test-instances. I.e. for an enum-class the test-instances would then turn out
to be the enum-constants.
The implementation is pretty much the simpliest possible by taking advantage
of features available in the runner-class BlockJUnit4ClassRunner. The
downside of this is that it demands JUnit version 4.5 or later ...
- Author:
- Henrik Kaipe
Method Summary |
protected org.junit.runner.Description |
describeChild(org.junit.runners.BlockJUnit4ClassRunner child)
|
protected List<org.junit.runners.BlockJUnit4ClassRunner> |
getChildren()
|
protected void |
runChild(org.junit.runners.BlockJUnit4ClassRunner child,
org.junit.runner.notification.RunNotifier notifier)
|
Methods inherited from class org.junit.runners.ParentRunner |
childrenInvoker, classBlock, collectInitializationErrors, filter, getDescription, getName, getTestClass, run, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses |
Methods inherited from class org.junit.runner.Runner |
testCount |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EnumRunner
public EnumRunner(Class<? extends Enum> testClass)
throws org.junit.runners.model.InitializationError
- Throws:
org.junit.runners.model.InitializationError
getChildren
protected List<org.junit.runners.BlockJUnit4ClassRunner> getChildren()
- Specified by:
getChildren
in class org.junit.runners.ParentRunner<org.junit.runners.BlockJUnit4ClassRunner>
describeChild
protected org.junit.runner.Description describeChild(org.junit.runners.BlockJUnit4ClassRunner child)
- Specified by:
describeChild
in class org.junit.runners.ParentRunner<org.junit.runners.BlockJUnit4ClassRunner>
runChild
protected void runChild(org.junit.runners.BlockJUnit4ClassRunner child,
org.junit.runner.notification.RunNotifier notifier)
- Specified by:
runChild
in class org.junit.runners.ParentRunner<org.junit.runners.BlockJUnit4ClassRunner>
Copyright © 2010-2013 Henrik Kaipe. All Rights Reserved.