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.junit4.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.
 }
 
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    CdiRunner(Class<?> clazz)
     
  • Method Summary

    Methods inherited from class org.junit.runners.ParentRunner

    filter, getDescription, getTestClass, order, run, setScheduler, sort

    Methods inherited from class org.junit.runner.Runner

    testCount

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CdiRunner

      public CdiRunner(Class<?> clazz) throws org.junit.runners.model.InitializationError
      Throws:
      org.junit.runners.model.InitializationError