|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.springtestdbunit.DbUnitRule
public class DbUnitRule
JUnit @Rule which provides support for @DatabaseSetup,
@DatabaseTearDown and @ExpectedDatabase annotations.
The fields of the test class will inspected to locate the IDatabaseConnection or DataSource to use.
Generally, a single @Autowired field is expected. It is also possible to configure the connection
directly using the setDatabaseConnection(org.dbunit.database.IDatabaseConnection) and setDataSource(javax.sql.DataSource) methods.
Datasets are loaded using the FlatXmlDataSetLoader unless a loader is located from a field of the test class
or specifically configured.
| Nested Class Summary | |
|---|---|
protected class |
DbUnitRule.DbUnitTestContextAdapter
|
| Constructor Summary | |
|---|---|
DbUnitRule()
|
|
| Method Summary | |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target)
|
void |
setDatabaseConnection(org.dbunit.database.IDatabaseConnection connection)
Set the IDatabaseConnection that will be used when running DBUnit tests. |
void |
setDataSetLoader(DataSetLoader dataSetLoader)
Set the DataSetLoader that will be used to load IDataSets. |
void |
setDataSource(DataSource dataSource)
Set the DataSource that will be used when running DBUnit tests. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DbUnitRule()
| Method Detail |
|---|
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
org.junit.runners.model.FrameworkMethod method,
Object target)
apply in interface org.junit.rules.MethodRulepublic void setDataSource(DataSource dataSource)
DataSource that will be used when running DBUnit tests. Note: Setting a data source will replace
any previously configured connection.
dataSource - The data sourcepublic void setDatabaseConnection(org.dbunit.database.IDatabaseConnection connection)
IDatabaseConnection that will be used when running DBUnit tests. Note: Setting a connection will
replace any previously configured dataSource.
connection - The connectionpublic void setDataSetLoader(DataSetLoader dataSetLoader)
DataSetLoader that will be used to load IDataSets.
dataSetLoader - The data set loader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||