Class AbstractJUnit4SpringContextTests

java.lang.Object
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
Direct Known Subclasses:
AbstractTransactionalJUnit4SpringContextTests

public abstract class AbstractJUnit4SpringContextTests extends Object implements org.springframework.context.ApplicationContextAware
Abstract base test class which integrates the Spring TestContext Framework with explicit ApplicationContext testing support in a JUnit 4 environment.

Concrete subclasses should typically declare a class-level @ContextConfiguration annotation to configure the application context resource locations or component classes.

This class serves only as a convenience for extension.

NOTE: This class requires JUnit 4.12 or higher.

Since:
2.5
Author:
Sam Brannen
See Also:
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
      Logger available to subclasses.
    • applicationContext

      @Nullable protected org.springframework.context.ApplicationContext applicationContext
      The ApplicationContext that was injected into this test instance via setApplicationContext(ApplicationContext).
  • Constructor Details

    • AbstractJUnit4SpringContextTests

      public AbstractJUnit4SpringContextTests()
  • Method Details

    • setApplicationContext

      public final void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Set the ApplicationContext to be used by this test instance, provided via ApplicationContextAware semantics.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Parameters:
      applicationContext - the ApplicationContext that this test runs in