Package ej.junit

Class AbstractTestWrapper

  • All Implemented Interfaces:
    TestWrapper

    public abstract class AbstractTestWrapper
    extends Object
    implements TestWrapper
    Base class used by generated wrappers. It is where the test execution happens. Implements the TestWrapper interface so it can be called by another application.
    • Field Detail

      • testClass

        protected final Class<?> testClass
      • testClassName

        protected final String testClassName
      • failed

        protected boolean failed
      • testMethod

        protected String testMethod
      • testMethodStart

        protected long testMethodStart
    • Constructor Detail

      • AbstractTestWrapper

        public AbstractTestWrapper​(Class<?> testClass)
        Creates a wrapper instance for the specified test class.

        Queries and store the class name, so clients of the wrappers can look them up by name if necessary.

        Parameters:
        testClass - the test class to instantiate.
    • Method Detail

      • reportTestEnd

        protected void reportTestEnd()
      • runBeforeClassMethods

        protected abstract void runBeforeClassMethods()
                                               throws Exception
        To be implemented by generated subclasses, triggers the execution of methods tagged with BeforeClass
        Throws:
        Exception - if one of the BeforeClass methods throws one.
      • runAfterClassMethods

        protected abstract void runAfterClassMethods()
                                              throws Exception
        To be implemented by generated subclasses, triggers the execution of methods tagged with AfterClass
        Throws:
        Exception - if one of the AfterClass methods throws one.
      • runBeforeMethods

        protected abstract void runBeforeMethods()
                                          throws Exception
        To be implemented by generated subclasses, triggers the execution of methods tagged with Before
        Throws:
        Exception - if one of the Before methods throws one.
      • runAfterMethods

        protected abstract void runAfterMethods()
                                         throws Exception
        To be implemented by generated subclasses, triggers the execution of methods tagged with After
        Throws:
        Exception - if one of the BeforeClass methods throws one.
      • runTestMethods

        protected abstract void runTestMethods()
        To be implemented by generated subclasses, triggers the execution of test methods tagged with Test
      • testInitialize

        protected final boolean testInitialize​(String testMethodName)
        Called by generated subclasses to trigger test initialization, by instantiating the test class and calling the Before methods.
        Parameters:
        testMethodName - the name of the test method to initialize.
        Returns:
        true if the operation succeeded and the test can continue, false otherwise.
      • testFinalize

        protected final void testFinalize​(boolean success)
        Called by generated subclasses to trigger test finalization. Reports the test end and calls the After methods. This method only exists for backward compatibility with JUnit before 1.10.0.
        Parameters:
        success - is ignored
      • testFinalize

        protected final void testFinalize()
        Called by generated subclasses to trigger test finalization. Reports the test end and calls the After methods.