Class DefaultTestContext

  • java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String[] attributeNames()
      Return the names of all attributes.
      ApplicationContext getApplicationContext()
      Get the application context for this test context.
      java.lang.Object getAttribute(java.lang.String name)
      Get the value of the attribute identified by name.
      java.lang.Class<?> getTestClass()
      Get the test class for this test context.
      java.lang.Throwable getTestException()
      Get the exception that was thrown during execution of the test method.
      java.lang.Object getTestInstance()
      Get the current test instance for this test context.
      java.lang.reflect.Method getTestMethod()
      Get the current test method for this test context.
      boolean hasAttribute(java.lang.String name)
      Return true if the attribute identified by name exists.
      void markApplicationContextDirty(DirtiesContext.HierarchyMode hierarchyMode)
      Mark the application context associated with this test context as dirty (i.e., by removing it from the context cache and closing it).
      java.lang.Object removeAttribute(java.lang.String name)
      Remove the attribute identified by name and return its value.
      void setAttribute(java.lang.String name, java.lang.Object value)
      Set the attribute defined by name to the supplied value.
      java.lang.String toString()
      Provide a String representation of this test context's state.
      void updateState(java.lang.Object testInstance, java.lang.reflect.Method testMethod, java.lang.Throwable testException)
      Update this test context to reflect the state of the currently executing test.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • DefaultTestContext

        public DefaultTestContext(DefaultTestContext testContext)
        Copy constructor for creating a new DefaultTestContext based on the attributes and immutable state of the supplied context.

        Immutable state includes all arguments supplied to the standard constructor.

        java.lang.NullPointerException - if the supplied DefaultTestContext is null
      • DefaultTestContext

        public DefaultTestContext(java.lang.Class<?> testClass,
                                  MergedContextConfiguration mergedContextConfiguration,
                                  CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate)
        Construct a new DefaultTestContext from the supplied arguments.
        testClass - the test class for this test context
        mergedContextConfiguration - the merged application context configuration for this test context
        cacheAwareContextLoaderDelegate - the delegate to use for loading and closing the application context for this test context