|
||||||||||
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.AbstractSpringContextTests
public abstract class AbstractSpringContextTests
Superclass for JUnit test cases using a Spring context.
Maintains a static cache of contexts by key. This has significant performance benefit if initializing the context would take time. While initializing a Spring context itself is very quick, some beans in a context, such as a LocalSessionFactoryBean for working with Hibernate, may take time to initialize. Hence it often makes sense to do that initializing once.
Normally you won't extend this class directly, but extend one of its subclasses.
AbstractDependencyInjectionSpringContextTests
,
AbstractTransactionalSpringContextTests
,
AbstractTransactionalDataSourceSpringContextTests
Field Summary | |
---|---|
protected Log |
logger
Logger available to subclasses. |
Constructor Summary | |
---|---|
AbstractSpringContextTests()
Default constructor for AbstractSpringContextTests. |
|
AbstractSpringContextTests(String name)
Constructor for AbstractSpringContextTests with a JUnit name. |
Method Summary | |
---|---|
protected String |
contextKeyString(Object contextKey)
Subclasses can override this to return a String representation of their contextKey for use in logging |
protected ConfigurableApplicationContext |
getContext(Object key)
|
protected boolean |
hasCachedContext(Object contextKey)
|
protected ConfigurableApplicationContext |
loadContext(Object key)
|
protected ConfigurableApplicationContext |
loadContextLocations(String[] locations)
Subclasses can invoke this to get a context key for the given location. |
protected void |
setDirty(String[] locations)
Set custom locations dirty. |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runBare, 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Log logger
Constructor Detail |
---|
public AbstractSpringContextTests()
public AbstractSpringContextTests(String name)
Method Detail |
---|
protected void setDirty(String[] locations)
Call this method only if you change the state of a singleton bean, potentially affecting future tests.
protected boolean hasCachedContext(Object contextKey)
protected String contextKeyString(Object contextKey)
protected ConfigurableApplicationContext getContext(Object key)
protected ConfigurableApplicationContext loadContextLocations(String[] locations)
protected ConfigurableApplicationContext loadContext(Object key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |