|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests
@TestExecutionListeners(value={DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class}) public abstract class AbstractJUnit38SpringContextTests
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
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
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
.
Constructor Detail |
---|
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 executeMethod Detail |
---|
public 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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |