org.springframework.test.context.junit38
Class AbstractJUnit38SpringContextTests

java.lang.Object
  extended by TestCase
      extended by org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests
All Implemented Interfaces:
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 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:

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

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:

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

Nested Class Summary
private static interface AbstractJUnit38SpringContextTests.TestExecutionCallback
          Deprecated. Private inner class that defines a callback analogous to Runnable , just declaring Throwable.
 
Field Summary
protected  ApplicationContext applicationContext
          Deprecated. The ApplicationContext that was injected into this test instance via setApplicationContext(ApplicationContext).
private static int disabledTestCount
          Deprecated.  
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.
private  TestContextManager testContextManager
          Deprecated.  
 
Constructor Summary
AbstractJUnit38SpringContextTests()
          Deprecated. Constructs a new AbstractJUnit38SpringContextTests instance; initializes the internal TestContextManager for the current test; and retrieves the configured (or default) ProfileValueSource.
AbstractJUnit38SpringContextTests(java.lang.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
static int getDisabledTestCount()
          Deprecated. Return the number of tests disabled in this environment.
private  java.lang.reflect.Method getTestMethod()
          Deprecated. Get the current test method.
protected  void recordDisabled(java.lang.reflect.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.
private  void runManaged(java.lang.reflect.Method testMethod)
          Deprecated. Calls TestContextManager.beforeTestMethod(Object,Method) and TestContextManager.afterTestMethod(Object,Method,Throwable) at the appropriate test execution points.
private  void runTest(AbstractJUnit38SpringContextTests.TestExecutionCallback tec, java.lang.reflect.Method testMethod)
          Deprecated. Runs a test via the supplied AbstractJUnit38SpringContextTests.TestExecutionCallback, providing support for the @ExpectedException and @Repeat annotations.
private  void runTestTimed(AbstractJUnit38SpringContextTests.TestExecutionCallback tec, java.lang.reflect.Method testMethod)
          Deprecated. Runs a timed test via the supplied AbstractJUnit38SpringContextTests.TestExecutionCallback , providing support for the @Timed annotation.
 void setApplicationContext(ApplicationContext applicationContext)
          Deprecated. Sets the ApplicationContext to be used by this test instance, provided via ApplicationContextAware semantics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

disabledTestCount

private static int disabledTestCount
Deprecated. 

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.


testContextManager

private final TestContextManager testContextManager
Deprecated. 
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(java.lang.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 java.lang.Throwable
Deprecated. 
Runs the Spring TestContext Framework test sequence.

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

Throws:
java.lang.Throwable
See Also:
ProfileValueUtils.isTestEnabledInThisEnvironment(java.lang.Class)

getTestMethod

private java.lang.reflect.Method getTestMethod()
Deprecated. 
Get the current test method.


runTestTimed

private void runTestTimed(AbstractJUnit38SpringContextTests.TestExecutionCallback tec,
                          java.lang.reflect.Method testMethod)
                   throws java.lang.Throwable
Deprecated. 
Runs a timed test via the supplied AbstractJUnit38SpringContextTests.TestExecutionCallback , providing support for the @Timed annotation.

Parameters:
tec - the test execution callback to run
testMethod - the actual test method: used to retrieve the timeout
Throws:
java.lang.Throwable - if any exception is thrown
See Also:
Timed, runTest(org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.TestExecutionCallback, java.lang.reflect.Method)

runTest

private void runTest(AbstractJUnit38SpringContextTests.TestExecutionCallback tec,
                     java.lang.reflect.Method testMethod)
              throws java.lang.Throwable
Deprecated. 
Runs a test via the supplied AbstractJUnit38SpringContextTests.TestExecutionCallback, providing support for the @ExpectedException and @Repeat annotations.

Parameters:
tec - the test execution callback to run
testMethod - the actual test method: used to retrieve the @ExpectedException and @Repeat annotations
Throws:
java.lang.Throwable - if any exception is thrown
See Also:
ExpectedException, Repeat

runManaged

private void runManaged(java.lang.reflect.Method testMethod)
                 throws java.lang.Throwable
Deprecated. 
Calls TestContextManager.beforeTestMethod(Object,Method) and TestContextManager.afterTestMethod(Object,Method,Throwable) at the appropriate test execution points.

Parameters:
testMethod - the test method to run
Throws:
java.lang.Throwable - if any exception is thrown
See Also:
runBare(), TestCase#runTest()

recordDisabled

protected void recordDisabled(java.lang.reflect.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()