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.
}
| Modifier and Type | Field and Description |
|---|---|
protected org.jboss.weld.environment.se.WeldContainer |
container |
protected org.junit.runners.model.FrameworkMethod |
frameworkMethod |
protected Throwable |
startupException |
protected org.jboss.weld.environment.se.Weld |
weld |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
createTest() |
collectInitializationErrors, computeTestMethods, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutprotected org.jboss.weld.environment.se.Weld weld
protected org.jboss.weld.environment.se.WeldContainer container
protected Throwable startupException
protected org.junit.runners.model.FrameworkMethod frameworkMethod
public CdiRunner(Class<?> clazz) throws org.junit.runners.model.InitializationError
org.junit.runners.model.InitializationErrorCopyright © 2017–2018. All rights reserved.