| org.springunit.framework.SpringUnitTransactionalTest
All known Subclasses: org.springunit.framework.samples.jpetstore.dao.AbstractDaoTest, org.springunit.framework.junit4.SpringUnit4TransactionalTest, org.springunit.framework.tests.OneDeepTransactionalTest,
SpringUnitTransactionalTest | abstract public class SpringUnitTransactionalTest extends AbstractTransactionalSpringContextTests (Code) | | Extends Spring's test framework to support transactional 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 SpringUnitTransactionalTest is required by convention
to have a bean called Classname of type
SpringUnitContext, where Classname is
the simple name of the subclass of SpringUnitTransactionalTest.
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 | |
final protected String[] | getConfigLocations() Return list of file names that the
Spring test framework uses in order to create beans for testing. | final protected T | getObject(String key) Search for object identified by key
in the hierarchy of contexts. | protected void | onSetUpInTransaction() Subclasses should override this method to perform any setup operations,
such as populating a database table, within the transaction
created by this class. | protected void | onSetUpInTransactionAtBeginning() | final protected void | onTearDownAfterTransaction() Calls onTearDownAfterTransactionEnds so that subclasses can
insert behavior at conclusion of transaction. | protected void | onTearDownAfterTransactionEnds() Subclasses can override this method to perform cleanup here. |
SpringUnitTransactionalTest | protected SpringUnitTransactionalTest()(Code) | | Default constructor.
|
SpringUnitTransactionalTest | protected SpringUnitTransactionalTest(String name)(Code) | | Constructor with JUnit name.
Sets AutowireMode to "by name" (overriding the default, which is "by type").
Creates a hierarchy of contexts.
Parameters: fName - Name of JUnit test |
getConfigLocations | final protected String[] getConfigLocations()(Code) | | Return list of file names that the
Spring test framework uses in order to create beans for testing.
Array of string filenames |
getObject | final protected T getObject(String key) throws Exception(Code) | | Search for object identified by key
in the hierarchy of contexts.
Parameters: key - Identifier of data value to find Object if found or null throws: Exception - if errors occur when using reflectionto access the SpringUnitContext for anyclass in the list |
onSetUpInTransaction | protected void onSetUpInTransaction() throws Exception(Code) | | Subclasses should override this method to perform any setup operations,
such as populating a database table, within the transaction
created by this class.
NB: Not called if there is no transaction management, due to no
transaction manager being provided in the context.
Note: This overriding of onSetUpInTransaction
is deprecated in SpringUnit and will be removed in a future release.
Subclasses that previously overrode onSetUpInTransactionAtBeginning
should instead override this method.
throws: Exception - simply let any exception propagate |
onSetUpInTransactionAtBeginning | protected void onSetUpInTransactionAtBeginning() throws Exception(Code) | | throws: Exception - |
onTearDownAfterTransaction | final protected void onTearDownAfterTransaction() throws Exception(Code) | | Calls onTearDownAfterTransactionEnds so that subclasses can
insert behavior at conclusion of transaction.
The transaction is not open anymore at this point.
Follows by calling setDirty so that all beans created
from configuration files are refreshed.
throws: Exception - simply let any exception propagate |
onTearDownAfterTransactionEnds | protected void onTearDownAfterTransactionEnds() throws Exception(Code) | | Subclasses can override this method to perform cleanup here.
The transaction is not open anymore at this point.
throws: Exception - simply let any exception propagate |
|
|