All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dbunit.DBTestCase Maven / Gradle / Ivy

Go to download

dbUnit is a JUnit extension (also usable from Ant and Maven) targeted for database-driven projects that, among other things, puts your database into a known state between test runs. This is an excellent way to avoid the myriad of problems that can occur when one test case corrupts the database and causes subsequent tests to fail or exacerbate the damage.

There is a newer version: 2.8.0
Show newest version
package org.dbunit;

import org.dbunit.database.IDatabaseConnection;

/**
 * Base testCase for database testing.
* Subclasses may override {@link newDatabaseTester()} to plug-in a different implementation * of IDatabaseTester.
Default implementation uses a {@link PropertiesBasedJdbcDatabaseTester}. * * @author Felipe Leme */ public abstract class DBTestCase extends DatabaseTestCase { public DBTestCase() { super(); } public DBTestCase(String name) { super(name); } protected IDatabaseConnection getConnection() throws Exception { final IDatabaseTester databaseTester = getDatabaseTester(); assertNotNull( "DatabaseTester is not set", databaseTester ); return databaseTester.getConnection(); } /** * Creates a new IDatabaseTester. * Default implementation returns a {@link PropertiesBasedJdbcDatabaseTester}. */ protected IDatabaseTester newDatabaseTester() throws Exception { return new PropertiesBasedJdbcDatabaseTester(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy