Permalink
Browse files

Factored out getConnection

so that subclasses may override it
  • Loading branch information...
1 parent ff7b4c6 commit 27c497ef377c432d91e6bb3bb19e6a10060e91b9 Jakub Holy committed Dec 27, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/main/java/net/jakubholy/dbunitexpress/assertion/RowComparator.java
View
10 src/main/java/net/jakubholy/dbunitexpress/assertion/RowComparator.java
@@ -21,6 +21,7 @@
import org.dbunit.DatabaseTestCase;
import org.dbunit.DatabaseUnitRuntimeException;
import org.dbunit.IDatabaseTester;
+import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.DefaultTable;
@@ -140,15 +141,15 @@ protected final void initResultTableAndColumns(final IDatabaseTester databaseTes
try {
exceptionInterpreter = ExceptionInterpreterFactory.getInterpreter(
- databaseTester.getConnection().getConnection());
+ getConnection(databaseTester).getConnection());
} catch (Exception e) {
LOG.warn("initResultTableAndColumns: Failed to access the " +
"connection/metadata and thus will not be able to " +
"instantiate the appropriate ExceptionInterpreter.", e);
}
try {
- final ITable resultTable = databaseTester.getConnection().
+ final ITable resultTable = getConnection(databaseTester).
createQueryTable("rowComparatorTbl", sql);
initResultTableAndColumns(resultTable);
} catch (Exception e) {
@@ -162,6 +163,11 @@ protected final void initResultTableAndColumns(final IDatabaseTester databaseTes
} /* initResultTableAndColumns(String) */
+ /** Get a connection to the test database; subclasses may override. */
+ protected IDatabaseConnection getConnection(final IDatabaseTester databaseTester) throws Exception {
+ return databaseTester.getConnection();
+ }
+
/**
* Set {@link #resultTable} and use its metadata to initialize {@link #columnNames}.
* @param resultTable (required)

0 comments on commit 27c497e

Please sign in to comment.