public class DbUnitTestExecutionListener
extends org.springframework.test.context.support.AbstractTestExecutionListener
TestExecutionListener which provides support for @DatabaseSetup,
@DatabaseTearDown and @ExpectedDatabase annotations.
A bean named "dbUnitDatabaseConnection" or "dataSource" is expected in the
ApplicationContext associated with the test. This bean can contain either a IDatabaseConnection or a
DataSource . A custom bean name can also be specified using the
@DbUnitConfiguration annotation.
Datasets are loaded using the FlatXmlDataSetLoader and DBUnit database operation lookups are performed using
the DefaultDatabaseOperationLookup unless otherwise configured.
If you are running this listener in combination with the TransactionalTestExecutionListener then consider
using TransactionDbUnitTestExecutionListener instead.
TransactionDbUnitTestExecutionListener| Modifier and Type | Field and Description |
|---|---|
protected static String |
CONNECTION_ATTRIBUTE |
protected static String |
DATA_SET_LOADER_ATTRIBUTE |
protected static String |
DATABASE_OPERATION_LOOKUP_ATTRIBUTE |
| Constructor and Description |
|---|
DbUnitTestExecutionListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterTestMethod(org.springframework.test.context.TestContext testContext) |
void |
beforeTestMethod(org.springframework.test.context.TestContext testContext) |
void |
prepareTestInstance(com.github.springtestdbunit.DbUnitTestExecutionListener.DbUnitTestContextAdapter testContext) |
void |
prepareTestInstance(org.springframework.test.context.TestContext testContext) |
protected static final String CONNECTION_ATTRIBUTE
protected static final String DATA_SET_LOADER_ATTRIBUTE
protected static final String DATABASE_OPERATION_LOOKUP_ATTRIBUTE
public void prepareTestInstance(org.springframework.test.context.TestContext testContext)
throws Exception
prepareTestInstance in interface org.springframework.test.context.TestExecutionListenerprepareTestInstance in class org.springframework.test.context.support.AbstractTestExecutionListenerExceptionpublic void prepareTestInstance(com.github.springtestdbunit.DbUnitTestExecutionListener.DbUnitTestContextAdapter testContext)
throws Exception
Exceptionpublic void beforeTestMethod(org.springframework.test.context.TestContext testContext)
throws Exception
beforeTestMethod in interface org.springframework.test.context.TestExecutionListenerbeforeTestMethod in class org.springframework.test.context.support.AbstractTestExecutionListenerExceptionpublic void afterTestMethod(org.springframework.test.context.TestContext testContext)
throws Exception
afterTestMethod in interface org.springframework.test.context.TestExecutionListenerafterTestMethod in class org.springframework.test.context.support.AbstractTestExecutionListenerExceptionCopyright © 2016. All rights reserved.