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:
@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.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:
TestContext
,
TestContextManager
,
TestExecutionListeners
,
AbstractTransactionalJUnit38SpringContextTests
,
AbstractJUnit4SpringContextTests
,
AbstractTestNGSpringContextTests
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 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 . |
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. |
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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, setUp, tearDown, toString
protected final Log logger
protected ApplicationContext applicationContext
ApplicationContext
that was injected into this test instance
via setApplicationContext(ApplicationContext)
.protected final ProfileValueSource profileValueSource
ProfileValueSource
available to subclasses but primarily intended
for internal use to provide support for @IfProfileValue
.public AbstractJUnit38SpringContextTests()
TestContextManager
for the current test; and
retrieves the configured (or default) ProfileValueSource
.public AbstractJUnit38SpringContextTests(String name)
name
; initializes the internal
TestContextManager
for the current test; and retrieves the
configured (or default) ProfileValueSource
.name
- the name of the current test to executepublic static int getDisabledTestCount()
public final void setApplicationContext(ApplicationContext applicationContext)
ApplicationContext
to be used by this test instance,
provided via ApplicationContextAware
semantics.setApplicationContext
in interface ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectBeanInitializationException
public void runBare() throws Throwable
In addition to standard TestCase.runBare()
semantics, this
implementation performs the following:
prepareTestInstance()
,
beforeTestMethod()
, and
afterTestMethod()
on this test's TestContextManager
at the
appropriate test execution points.@IfProfileValue
.@Repeat
.@Timed
.@ExpectedException
.runBare
in class junit.framework.TestCase
Throwable
ProfileValueUtils.isTestEnabledInThisEnvironment(java.lang.Class<?>)
protected void recordDisabled(Method testMethod)
testMethod
- the test method that is disabled.getDisabledTestCount()