Package org.dbunit
Class DatabaseTestCase
java.lang.Object
org.dbunit.DatabaseTestCase
- All Implemented Interfaces:
org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.InvocationInterceptor,org.junit.jupiter.api.extension.TestInstantiationAwareExtension
- Direct Known Subclasses:
DBTestCase
public abstract class DatabaseTestCase
extends Object
implements org.junit.jupiter.api.extension.InvocationInterceptor
Convenience class for writing JUnit tests with dbunit easily.
Note that there are some even more convenient classes available such as
Note that there are some even more convenient classes available such as
DBTestCase.- Since:
- 1.0 (Feb 17, 2002)
- Version:
- $Revision$
- Author:
- Manuel Laflamme
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T>Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseConnection(IDatabaseConnection connection) Deprecated.protected abstract IDatabaseConnectionReturns the test database connection.protected IDatabaseTesterGets the IDatabaseTester for this testCase.
If the IDatabaseTester is not set yet, this method calls newDatabaseTester() to obtain a new instance.protected abstract IDataSetReturns the test dataset.getName()protected IOperationListenerprotected DatabaseOperationReturns the database operation executed in test setup.protected DatabaseOperationReturns the database operation executed in test cleanup.protected IDatabaseTesterCreates a IDatabaseTester for this testCase.
ADefaultDatabaseTesteris used by default.protected voidsetUp()protected voidsetUpDatabaseConfig(DatabaseConfig config) Designed to be overridden by subclasses in order to set additional configuration parameters for theIDatabaseConnection.protected voidtearDown()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestMethod, interceptTestTemplateMethodMethods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
getTestInstantiationExtensionContextScope
-
Constructor Details
-
DatabaseTestCase
protected DatabaseTestCase() -
DatabaseTestCase
-
-
Method Details
-
getName
-
getConnection
Returns the test database connection.- Throws:
Exception
-
getDataSet
Returns the test dataset.- Throws:
Exception
-
newDatabaseTester
Creates a IDatabaseTester for this testCase.
ADefaultDatabaseTesteris used by default.- Throws:
Exception
-
setUpDatabaseConfig
Designed to be overridden by subclasses in order to set additional configuration parameters for theIDatabaseConnection.- Parameters:
config- The settings of the currentIDatabaseConnectionto be configured
-
getDatabaseTester
Gets the IDatabaseTester for this testCase.
If the IDatabaseTester is not set yet, this method calls newDatabaseTester() to obtain a new instance.- Throws:
Exception
-
closeConnection
Deprecated.since 2.4.4 define a user definedgetOperationListener()in advanceClose the specified connection. Override this method of you want to keep your connection alive between tests.- Throws:
Exception
-
getSetUpOperation
Returns the database operation executed in test setup.- Throws:
Exception
-
getTearDownOperation
Returns the database operation executed in test cleanup.- Throws:
Exception
-
setUp
- Throws:
Exception
-
tearDown
- Throws:
Exception
-
getOperationListener
- Returns:
- The
IOperationListenerto be used by theIDatabaseTester. - Since:
- 2.4.4
-
getOperationListener()in advance