Package io.github.cdiunit
Class CdiRunner
java.lang.Object
org.junit.runner.Runner
org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
org.junit.runners.BlockJUnit4ClassRunner
io.github.cdiunit.CdiRunner
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Orderable
,org.junit.runner.manipulation.Sortable
public class CdiRunner
extends org.junit.runners.BlockJUnit4ClassRunner
@CdiRunner
is a JUnit runner that uses a CDI container to
create unit test objects. Simply add
@RunWith(CdiRunner.class)
to your test class.
@RunWith(CdiRunner.class) // Runs the test with CDI-Unit
class MyTest {
@Inject
Something something; // This will be injected before the tests are run!
... //The rest of the test goes here.
}
- Author:
- Bryn Cooke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.junit.runners.model.Statement
classBlock
(org.junit.runner.notification.RunNotifier notifier) protected Object
protected TestConfiguration
protected org.junit.runners.model.Statement
methodBlock
(org.junit.runners.model.FrameworkMethod frameworkMethod) Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, getTestRules, isIgnored, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
Methods inherited from class org.junit.runners.ParentRunner
childrenInvoker, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
Methods inherited from class org.junit.runner.Runner
testCount
-
Constructor Details
-
CdiRunner
- Throws:
org.junit.runners.model.InitializationError
-
-
Method Details
-
createTestConfiguration
-
createTest
- Overrides:
createTest
in classorg.junit.runners.BlockJUnit4ClassRunner
-
classBlock
protected org.junit.runners.model.Statement classBlock(org.junit.runner.notification.RunNotifier notifier) - Overrides:
classBlock
in classorg.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
methodBlock
protected org.junit.runners.model.Statement methodBlock(org.junit.runners.model.FrameworkMethod frameworkMethod) - Overrides:
methodBlock
in classorg.junit.runners.BlockJUnit4ClassRunner
-