org.springunit.framework
Class SpringUnitTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.springframework.test.ConditionalTestCase
org.springframework.test.AbstractSpringContextTests
org.springframework.test.AbstractSingleSpringContextTests
org.springframework.test.AbstractDependencyInjectionSpringContextTests
org.springunit.framework.SpringUnitTest
- All Implemented Interfaces:
- Test
- Direct Known Subclasses:
- SpringUnit4Test
public abstract class SpringUnitTest
- extends AbstractDependencyInjectionSpringContextTests
Extends Spring's test framework to support data-driven tests.
Data-driven tests separate data values from test logic,
keeping data values in external files and test logic in Java code.
Every descendent of SpringUnitTest is required by convention
to have a bean called Classname
of type
SpringUnitContext, where Classname
is
the simple name of the subclass of SpringUnitTest.
Note that the simple names of subclasses must be unique,
that is, they must not be distinguished solely by different
package qualifiers.
- Author:
- Ted Velkoff
Method Summary |
protected String[] |
getConfigLocations()
Return list of file names that the
Spring test framework uses in order to create beans for testing. |
protected
|
getObject(String key)
Search for object identified by key
in the hierarchy of contexts. |
Methods inherited from class org.springframework.test.AbstractSingleSpringContextTests |
contextKey, createApplicationContext, customizeBeanFactory, getApplicationContext, getConfigPath, getConfigPaths, getLoadCount, loadContext, loadContextLocations, onSetUp, onTearDown, setDirty, setUp, tearDown |
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 |
SpringUnitTest
protected SpringUnitTest()
- Default constructor.
SpringUnitTest
protected SpringUnitTest(String fName)
- Constructor with JUnit name.
Sets AutowireMode to "by name" (overriding the default, which is "by type").
Creates a context contexts that stores the
hierarchy of test contexts.
- Parameters:
fName
- Name of JUnit test
getConfigLocations
protected final String[] getConfigLocations()
- Return list of file names that the
Spring test framework uses in order to create beans for testing.
- Overrides:
getConfigLocations
in class AbstractSingleSpringContextTests
- Returns:
- Array of string filenames
getObject
protected final <T> T getObject(String key)
throws Exception
- Search for object identified by
key
in the hierarchy of contexts.
- Parameters:
key
- Identifier of data value to find
- Returns:
- Object if found or null
- Throws:
Exception
- if errors occur when using reflection
to access the SpringUnitContext for any
class in the list
Copyright © 2007 null. All Rights Reserved.