AbstractJUnit38SpringContextTests (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.test.context.junit38

## Class AbstractJUnit38SpringContextTests

- java.lang.Object
- - junit.framework.Assert
  - - junit.framework.TestCase
    - - org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests

- All Implemented Interfaces:
    junit.framework.Test, Aware, ApplicationContextAware
  Direct Known Subclasses:
    AbstractTransactionalJUnit38SpringContextTests

  Deprecated.
  as of Spring 3.1, in favor of using `AbstractJUnit4SpringContextTests`

      @Deprecated
      @TestExecutionListeners(value={DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class})
      public abstract class AbstractJUnit38SpringContextTests
      extends junit.framework.TestCase
      implements ApplicationContextAware

  Abstract base `TestCase` which integrates the Spring TestContext Framework and explicit `ApplicationContext` testing support in a JUnit 3.8 environment.

  Concrete subclasses:

  - Typically declare a class-level `@ContextConfiguration` annotation to configure the `application context` `resource locations`. If your test does not need to load an application context, you may choose to omit the `@ContextConfiguration` declaration and configure the appropriate `TestExecutionListeners` manually.
  - Must declare public constructors which match the signatures of `AbstractJUnit38SpringContextTests()` and `AbstractJUnit38SpringContextTests(String)` and delegate to `super();` and `super(name);` respectively.

  The following list constitutes all annotations currently supported directly by `AbstractJUnit38SpringContextTests`. (Note that additional annotations may be supported by various `TestExecutionListeners`)

  - `@DirtiesContext` (via the configured `DirtiesContextTestExecutionListener`; only supported on methods for JUnit 3.8)
  - `@ProfileValueSourceConfiguration`
  - `@IfProfileValue`
  - `@ExpectedException`
  - `@Timed`
  - `@Repeat`

  JUnit 3.8 does not support before class or after class lifecycle callbacks. The following `TestExecutionListener` methods are therefore unsupported in a JUnit 3.8 environment:

  - `beforeTestClass()`
  - `afterTestClass()`
  Since:
    2.5
  Author:
    Sam Brannen, Juergen Hoeller
  See Also:
    `TestContext`, `TestContextManager`, `TestExecutionListeners`, `AbstractTransactionalJUnit38SpringContextTests`, `AbstractJUnit4SpringContextTests`, `AbstractTestNGSpringContextTests`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ApplicationContext` | `applicationContext` Deprecated. The `ApplicationContext` that was injected into this test instance via `setApplicationContext(ApplicationContext)`.
    `protected Log` | `logger` Deprecated. Logger available to subclasses.
    `protected ProfileValueSource` | `profileValueSource` Deprecated. `ProfileValueSource` available to subclasses but primarily intended for internal use to provide support for `@IfProfileValue`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractJUnit38SpringContextTests()` Deprecated. Constructs a new AbstractJUnit38SpringContextTests instance; initializes the internal `TestContextManager` for the current test; and retrieves the configured (or default) `ProfileValueSource`.
    `AbstractJUnit38SpringContextTests(String name)` Deprecated. Constructs a new AbstractJUnit38SpringContextTests instance with the supplied `name`; initializes the internal `TestContextManager` for the current test; and retrieves the configured (or default) `ProfileValueSource`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `getDisabledTestCount()` Deprecated. Return the number of tests disabled in this environment.
    `protected void` | `recordDisabled(Method testMethod)` Deprecated. Records the supplied test method as disabled in the current environment by incrementing the total number of disabled tests and logging a debug message.
    `void` | `runBare()` Deprecated. Runs the Spring TestContext Framework test sequence.
    `void` | `setApplicationContext(ApplicationContext applicationContext)` Deprecated. Sets the `ApplicationContext` to be used by this test instance, provided via `ApplicationContextAware` semantics.

    - ### Methods inherited from class junit.framework.TestCase

      `countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, toString`

    - ### Methods inherited from class junit.framework.Assert

      `assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected final Log logger

      Deprecated.
      Logger available to subclasses.

    - #### applicationContext

          protected ApplicationContext applicationContext

      Deprecated.
      The `ApplicationContext` that was injected into this test instance via `setApplicationContext(ApplicationContext)`.

    - #### profileValueSource

          protected final ProfileValueSource profileValueSource

      Deprecated.
      `ProfileValueSource` available to subclasses but primarily intended for internal use to provide support for `@IfProfileValue`.

  - ### Constructor Detail

    - #### AbstractJUnit38SpringContextTests

          public AbstractJUnit38SpringContextTests()

      Deprecated.
      Constructs a new AbstractJUnit38SpringContextTests instance; initializes the internal `TestContextManager` for the current test; and retrieves the configured (or default) `ProfileValueSource`.

    - #### AbstractJUnit38SpringContextTests

          public AbstractJUnit38SpringContextTests(String name)

      Deprecated.
      Constructs a new AbstractJUnit38SpringContextTests instance with the supplied `name`; initializes the internal `TestContextManager` for the current test; and retrieves the configured (or default) `ProfileValueSource`.
      Parameters:
        `name` - the name of the current test to execute

  - ### Method Detail

    - #### getDisabledTestCount

          public static int getDisabledTestCount()

      Deprecated.
      Return the number of tests disabled in this environment.

    - #### setApplicationContext

          public final void setApplicationContext(ApplicationContext applicationContext)

      Deprecated.
      Sets the `ApplicationContext` to be used by this test instance, provided via `ApplicationContextAware` semantics.
      Specified by:
        `setApplicationContext` in interface `ApplicationContextAware`
      Parameters:
        `applicationContext` - the ApplicationContext object to be used by this object
      See Also:
        `BeanInitializationException`

    - #### runBare

          public void runBare()
                       throws Throwable

      Deprecated.
      Runs the Spring TestContext Framework test sequence.

      In addition to standard `TestCase.runBare()` semantics, this implementation performs the following:

      - Calls `prepareTestInstance()`, `beforeTestMethod()`, and `afterTestMethod()` on this test's `TestContextManager` at the appropriate test execution points.
      - Provides support for `@IfProfileValue`.
      - Provides support for `@Repeat`.
      - Provides support for `@Timed`.
      - Provides support for `@ExpectedException`.
      Overrides:
        `runBare` in class `junit.framework.TestCase`
      Throws:
        `Throwable`
      See Also:
        `ProfileValueUtils.isTestEnabledInThisEnvironment(java.lang.Class<?>)`

    - #### recordDisabled

          protected void recordDisabled(Method testMethod)

      Deprecated.
      Records the supplied test method as disabled in the current environment by incrementing the total number of disabled tests and logging a debug message.
      Parameters:
        `testMethod` - the test method that is disabled.
      See Also:
        `getDisabledTestCount()`