The Spring Framework

org.springframework.test.context.junit38
Class AbstractJUnit38SpringContextTests

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests
All Implemented Interfaces:
junit.framework.Test, ApplicationContextAware
Direct Known Subclasses:
AbstractTransactionalJUnit38SpringContextTests

@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 with explicit ApplicationContext testing support in a JUnit 3.8 environment.

Concrete subclasses:

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

Since:
2.5
Author:
Sam Brannen, Juergen Hoeller
See Also:
TestContext, TestContextManager, TestExecutionListeners, AbstractTransactionalJUnit38SpringContextTests, AbstractJUnit4SpringContextTests, AbstractTestNGSpringContextTests

Field Summary
protected  ApplicationContext applicationContext
          The ApplicationContext that was injected into this test instance via setApplicationContext(ApplicationContext).
protected  Log logger
          Logger available to subclasses.
protected  ProfileValueSource profileValueSource
          ProfileValueSource available to subclasses but primarily intended for internal use to provide support for @IfProfileValue.
 
Constructor Summary
AbstractJUnit38SpringContextTests()
          Constructs a new AbstractJUnit38SpringContextTests instance; initializes the internal TestContextManager for the current test; and retrieves the configured (or default) ProfileValueSource.
AbstractJUnit38SpringContextTests(String name)
          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
static int getDisabledTestCount()
          Return the number of tests disabled in this environment.
protected  void recordDisabled(Method testMethod)
          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()
          Runs the Spring TestContext Framework test sequence.
 void setApplicationContext(ApplicationContext applicationContext)
          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
Logger available to subclasses.


applicationContext

protected ApplicationContext applicationContext
The ApplicationContext that was injected into this test instance via setApplicationContext(ApplicationContext).


profileValueSource

protected final ProfileValueSource profileValueSource
ProfileValueSource available to subclasses but primarily intended for internal use to provide support for @IfProfileValue.

Constructor Detail

AbstractJUnit38SpringContextTests

public AbstractJUnit38SpringContextTests()
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)
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()
Return the number of tests disabled in this environment.


setApplicationContext

public final void setApplicationContext(ApplicationContext applicationContext)
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
Runs the Spring TestContext Framework test sequence.

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

Overrides:
runBare in class junit.framework.TestCase
Throws:
Throwable
See Also:
ProfileValueUtils.isTestEnabledInThisEnvironment(org.springframework.test.annotation.ProfileValueSource, java.lang.reflect.Method, java.lang.Class)

recordDisabled

protected void recordDisabled(Method testMethod)
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()

The Spring Framework

Copyright © 2002-2008 The Spring Framework.