| java.lang.Object org.springunit.framework.HierarchicalSpringUnitContext
HierarchicalSpringUnitContext | public class HierarchicalSpringUnitContext (Code) | | Manages the contexts of a SpringUnit test.
Stores an ordered list of the classes that comprise
the class hierarchy for the test (testClasses ).
The first element in the list is the class of the test,
the last element is the descendent of the descendent
of AbstractDependencyInjectionSpringContextTests
or AbstractTransactionalSpringContextTests
that is an ancestor of the test class.
Using the list of classes in the hierarchy,
creates and provides a corresponding list of
resources that describe configuration data used
to populate the corresponding contexts.
Given a name for a data value, a name of a test
and the test object itself, traverses the
hierarchy of contexts to return the requested
data value, if it exists.
author: Ted Velkoff |
Constructor Summary | |
protected | HierarchicalSpringUnitContext(Class<? extends S> testClass) Given the class of the current test (testClass ),
construct an ordered list of classes, where the first class is
testClass , the second class is the superclass of
testClass (if any), the third class is the superclass
of the second (if any), etc., and the last class is
the immediate descendent of the immediate descendent of
AbstractDependencyInjectionSpringContextTests
or AbstractTransactionalSpringContextTests. |
Method Summary | |
protected String[] | getConfigLocations() Given the list of test classes in the hierarchy,
return the list of resource names that satisfy the naming convention
"Classname.xml".
Caches the list of locations so this need only be computed once. | protected T | getObject(String key, String fName, Object test) Search for object identified by key
in the hierarchy of classes descending from
the descendent of AbstractDependencyInjectionSpringContextTests
or AbstractTransactionalSpringContextTests. |
HierarchicalSpringUnitContext | protected HierarchicalSpringUnitContext(Class<? extends S> testClass)(Code) | | Given the class of the current test (testClass ),
construct an ordered list of classes, where the first class is
testClass , the second class is the superclass of
testClass (if any), the third class is the superclass
of the second (if any), etc., and the last class is
the immediate descendent of the immediate descendent of
AbstractDependencyInjectionSpringContextTests
or AbstractTransactionalSpringContextTests.
Parameters: testClass - Class of test whose class hierarchy is to be constructed. |
getConfigLocations | protected String[] getConfigLocations()(Code) | | Given the list of test classes in the hierarchy,
return the list of resource names that satisfy the naming convention
"Classname.xml".
Caches the list of locations so this need only be computed once.
Array of string filenames |
getObject | protected T getObject(String key, String fName, Object test) throws Exception(Code) | | Search for object identified by key
in the hierarchy of classes descending from
the descendent of AbstractDependencyInjectionSpringContextTests
or AbstractTransactionalSpringContextTests.
This hierarchy is expressed as a list (testClasses )
with lowest first and highest last.
Iterates through this list,
calling getObject(key, getName(), c)
until a non-null result is returned or
every member of the list has been visited.
Parameters: key - Identifier of data value to find Parameters: fName - Name of test Parameters: test - SpringUnit test whose context will be searched Object of type T if found or null throws: Exception - if errors occur when using reflectionto access the SpringUnitContext for anyclass in the list |
|
|