Class WeldJUnitRunner

  • All Implemented Interfaces:
    org.junit.runner.Describable, org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Orderable, org.junit.runner.manipulation.Sortable

    public class WeldJUnitRunner
    extends org.junit.runners.BlockJUnit4ClassRunner
    Simple JUnit test runner which automatically takes care of starting Weld container before the test runs and stopping the Weld after the test finishes.

    The test class can also use all CDI constructs (like @Inject). For example the test can inject BeanManager: ...

    • Constructor Summary

      Constructors 
      Constructor Description
      WeldJUnitRunner​(Class<?> testClass)
      Creates a WeldJUnitRunner to run testClass
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Object createTest()  
      void runChild​(org.junit.runners.model.FrameworkMethod method, org.junit.runner.notification.RunNotifier notifier)  
      • Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner

        collectInitializationErrors, computeTestMethods, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, methodInvoker, possiblyExpectingExceptions, rules, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
      • Methods inherited from class org.junit.runners.ParentRunner

        childrenInvoker, classBlock, 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 Detail

      • WeldJUnitRunner

        public WeldJUnitRunner​(Class<?> testClass)
                        throws org.junit.runners.model.InitializationError
        Creates a WeldJUnitRunner to run testClass
        Parameters:
        testClass -
        Throws:
        org.junit.runners.model.InitializationError - if the test class is malformed.
    • Method Detail

      • createTest

        protected Object createTest()
                             throws Exception
        Overrides:
        createTest in class org.junit.runners.BlockJUnit4ClassRunner
        Throws:
        Exception
      • runChild

        public void runChild​(org.junit.runners.model.FrameworkMethod method,
                             org.junit.runner.notification.RunNotifier notifier)
        Overrides:
        runChild in class org.junit.runners.BlockJUnit4ClassRunner