Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ updates:
patterns:
- "org.junit*:*"
- "org.mockito:*"
- "org.hamcrest:*"
- "org.assertj:*"
update-types: ["minor", "patch"]
# JDBC drivers and embedded databases used in integration tests
Expand Down
22 changes: 0 additions & 22 deletions dbUnit tests - derby.launch

This file was deleted.

22 changes: 0 additions & 22 deletions dbUnit tests - hsqldb.launch

This file was deleted.

7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
<project.scm.id>github</project.scm.id>

<!-- General values -->
<!-- Bytecode level of the shipped jar, for consumer compatibility. -->
<compileSource>1.8</compileSource>
<!-- Minimum JDK to build/test dbUnit itself: junit-jupiter 6.x class files
require Java 17 to load (verified: bytecode major version 61), so this
must stay >= 17 regardless of compileSource above. -->
<enforcerJavaVersion>17</enforcerJavaVersion>
<checkstyle.excludes>org/dbunit/util/concurrent/*.java</checkstyle.excludes>
<mavenVersion>3.0.4</mavenVersion>
<!-- non-UTC timezone for testing -->
Expand Down Expand Up @@ -697,7 +702,7 @@
<version>${mavenVersion}</version>
</requireMavenVersion>
<requireJavaVersion>
<version>${compileSource}</version>
<version>${enforcerJavaVersion}</version>
</requireJavaVersion>
<requirePluginVersions>
<phases>compile</phases>
Expand Down
27 changes: 27 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,33 @@
<action dev="dependabot" type="update" due-to="Dependabot">Update maven dependency org.junit.platform:junit-platform-suite-engine from 6.1.1 to 6.1.2 (#818).</action>
<!-- dependabot:dep=ch.qos.logback:logback-classic:new=1.6.0:pr=819 -->
<action dev="dependabot" type="update" due-to="Dependabot">Update maven dependency ch.qos.logback:logback-classic from 1.5.38 to 1.6.0 (#819).</action>
<action dev="jeffjensen" type="fix" issue="870" system="github" due-to="jeffjensen">
Replace TransactionOperationIT's dead JUnit-3-era runTest(String) feature gate (a leftover from the JUnit migration, never invoked under Jupiter) with a real @BeforeEach Assumptions.assumeTrue(environmentHasFeature(TestFeature.TRANSACTION)) check, restoring the class's intended skip-on-unsupported-database protection.
</action>
<action dev="jeffjensen" type="remove" issue="869" system="github" due-to="jeffjensen">
Remove the dead JUnit-3-era runTest(String)/runTest() gating-hook override chain from AbstractDatabaseIT, AbstractTableTest, TruncateTableOperationIT, and InsertIdentityOperationIT: a leftover from the JUnit migration, never invoked under Jupiter (there is no TestCase base to call it), and redundant with each class's already-active @EnabledIfSystemProperty/@DisabledIfSystemProperty gating.
</action>
<action dev="jeffjensen" type="remove" issue="871" system="github" due-to="jeffjensen">
Remove 27 orphaned JUnit Platform @Suite/@SelectClasses aggregator classes (AllTestsSuite/AllAssertionTestSuite/DatabaseTestSuite across nearly every package): a leftover JUnit 3/4-era "suite of suites" pattern that Surefire/Failsafe's filename-pattern test discovery (**/*Test.java, **/*IT.java) never executed, confirmed unreferenced by any CI workflow, build script, site doc, or IDE configuration.
</action>
<action dev="jeffjensen" type="fix" issue="872" system="github" due-to="jeffjensen">
Fix DbUnitAssertBase's JUnit-detection classpath probe, a leftover from the JUnit migration: it checked for junit.framework.Assert (JUnit 3/4), a class never present since the vintage engine was dropped, permanently disabling the JUnitFailureFactory path. Point the probe at org.junit.jupiter.api.Assertions instead. JUnitFailureFactory continues to return dbUnit's own DbComparisonFailure/DbAssertionFailedError (not a JUnit-framework-specific type) so that no dbUnit user incurs a runtime dependency on any particular test framework's failure classes; removed the stale comments and "TODO Junit5 update" left over from when this was last touched.
</action>
<action dev="jeffjensen" type="fix" issue="873" system="github" due-to="jeffjensen">
Split the enforcer plugin's requireJavaVersion rule from compileSource into a new enforcerJavaVersion property (17), since JUnit 6's class files require Java 17 to load (verified: bytecode major version 61) -- a build attempted on the previously-declared minimum, Java 8, could not run tests at all. compileSource (1.8) is unchanged and continues to set the shipped jar's bytecode level for consumers who don't need dbUnit's JUnit test-support classes.
</action>
<action dev="jeffjensen" type="fix" issue="874" system="github" due-to="jeffjensen">
Fix the "dbUnit in 5 Minutes" tutorial's contradictory prerequisites: it told new users "JDK 8 or newer" immediately above "JUnit 5 (org.junit.jupiter:junit-jupiter) on your test classpath", but the current JUnit Jupiter coordinates (6.x) cannot load on Java 8-16. Clarify that JDK 17+ is needed to build/run the tutorial's test, while JDK 8 remains sufficient for dbUnit's core API alone.
</action>
<action dev="jeffjensen" type="remove" issue="875" system="github" due-to="jeffjensen">
Remove the two Eclipse launch configs ("dbUnit tests - derby.launch", "dbUnit tests - hsqldb.launch"), last updated in 2024 and still set to Eclipse's JUnit 4 test loader, which cannot discover or run this project's pure-Jupiter test suite at all; both also carried dbunit.profile.unsupportedFeatures VM arguments that had drifted from the current *-dbunit.properties files. Removed rather than fixed, per maintainer confirmation that no one relies on Eclipse-native (non-Maven) test runs for these profiles.
</action>
<action dev="jeffjensen" type="remove" issue="876" system="github" due-to="jeffjensen">
Remove the dead org.hamcrest:* pattern from dependabot.yml's test-dependencies group: hamcrest has not been a dependency since the JUnit migration (no hamcrestVersion property, no org.hamcrest import anywhere), so the pattern has silently matched zero packages on every Dependabot run.
</action>
<action dev="jeffjensen" type="update" issue="877" system="github" due-to="jeffjensen">
Generalize current-tense "JUnit 5" wording to "JUnit 5/6" in fiveminutes.adoc, testcases.adoc, and testcases/MigratingToIDatabaseTester.adoc, now that the project ships and tests against JUnit 6 (same org.junit.jupiter:junit-jupiter coordinates, so this is a wording generalization, not a correction). Left historical-milestone text (index.adoc's "Since 3.0.0..." framing) and changes.xml action text untouched, since those describe what was true at the time.
</action>
Comment thread
jeffjensen marked this conversation as resolved.
</release>
<release version="3.4.0" date="Jul 28, 2026" description="Test-suite hardening (un-skip and strengthen dozens of disabled/no-op tests); add CachingConnectionProvider and reduce DefaultPrepAndExpectedTestCase's per-test connection churn; pin identifier case-folding to Locale.ENGLISH for Turkish-locale correctness; and a broad set of correctness fixes across export formats (XML, YAML, CSV, XLS, Ant), TimestampDataType timezone handling, InsertOperation/TransactionOperation, and resource-leak cleanups">
<action dev="jeffjensen" type="fix" issue="797" system="github" due-to="jeffjensen">
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/dbunit/assertion/DbUnitAssertBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private FailureFactory getJUnitFailureFactory()
{
try
{
Class.forName("junit.framework.Assert");
Class.forName("org.junit.jupiter.api.Assertions");
// JUnit available
return new JUnitFailureFactory();
} catch (final ClassNotFoundException e)
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/org/dbunit/assertion/JUnitFailureFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
*/
package org.dbunit.assertion;

import org.opentest4j.AssertionFailedError;

/**
* Adapter that lets dbunit create JUnit failure objects.
*
* <p>
* Returns dbUnit's own {@link DbComparisonFailure}/{@link DbAssertionFailedError}
* rather than a JUnit-framework-specific failure type. dbUnit's own types are used
* even when JUnit is confirmed present (see {@link org.dbunit.assertion.DbUnitAssertBase})
* so that the object returned here never requires a runtime dependency on any
* particular test framework's failure classes.
*
Comment thread
coderabbitai[bot] marked this conversation as resolved.
* @author gommma (gommma AT users.sourceforge.net)
* @author Last changed by: $Author$
* @version $Revision$ $Date$
Expand All @@ -33,18 +37,13 @@
public class JUnitFailureFactory implements FailureFactory {
@Override
public Error createFailure(final String message, final String expected, final String actual) {
// Return the org.opentest4j.AssertionFailedError object
// TODO Junit5 update something changed the message returned does not include
// the actual and exected
// adding it here for now.
return new DbComparisonFailure(
message,
expected, actual);
}

@Override
public Error createFailure(final String message) {
// Return the org.opentest4j.AssertionFailedError object
return new AssertionFailedError(message);
return new DbAssertionFailedError(message);
}
}
6 changes: 4 additions & 2 deletions src/site/asciidoc/fiveminutes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ In 5 minutes you'll write a database test that prepares data, exercises your cod

== Prerequisites

* JDK 8 or newer.
* JUnit 5 (`org.junit.jupiter:junit-jupiter`) on your test classpath.
* JDK 17 or newer to build and run this tutorial's test (JUnit 6 requires it). The
dbUnit library itself still targets Java 8 bytecode, so JDK 8 remains enough if you
only use its core API without JUnit's test-support classes.
* JUnit 5 or 6 (`org.junit.jupiter:junit-jupiter`) on your test classpath.
* An in-memory database for the example — this tutorial uses
https://www.h2database.com/[H2] so there's nothing to install or run.

Expand Down
2 changes: 1 addition & 1 deletion src/site/asciidoc/testcases.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class SampleTest extends DBTestCase
----

NOTE: `DatabaseTestCase.setUp()`/`tearDown()` are plain protected methods,
not automatically invoked by JUnit 5 — override them with `@BeforeEach`/
not automatically invoked by JUnit 5/6 — override them with `@BeforeEach`/
`@AfterEach` and call `super` as shown, matching every
`DBTestCase`-subclass page linked above.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ public class SampleTest extends TestCase
----

This is what `IDatabaseTester` composition (above) descends from — the
difference today is only that JUnit 5's `@BeforeEach`/`@AfterEach`
difference today is only that JUnit 5/6's `@BeforeEach`/`@AfterEach`
annotations replace JUnit 3/4's `setUp()`/`tearDown()` method-name
convention.
28 changes: 0 additions & 28 deletions src/test/java/org/dbunit/AbstractDatabaseIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,34 +165,6 @@ protected void closeConnection(final IDatabaseConnection connection)
// return DatabaseOperation.DELETE_ALL;
// }

/**
* This method is used so sub-classes can disable the tests according to
* some characteristics of the environment
*
* @param testName
* name of the test to be checked
* @return flag indicating if the test should be executed or not
*/
protected boolean runTest(final String testName)
{
return true;
}

protected void runTest() throws Throwable
{
if (runTest(getName()))
{
// super.runTest();
} else
{
if (logger.isDebugEnabled())
{
logger.debug("Skipping test " + getClass().getName() + "."
+ getName());
}
}
}

public static boolean environmentHasFeature(final TestFeature feature)
{
try
Expand Down
46 changes: 0 additions & 46 deletions src/test/java/org/dbunit/AllTestsSuite.java

This file was deleted.

37 changes: 0 additions & 37 deletions src/test/java/org/dbunit/assertion/AllAssertionTestSuite.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;
import org.opentest4j.AssertionFailedError;

/**
* Unit tests for {@link JUnitFailureFactory}, which also exercises the
Expand All @@ -34,13 +33,13 @@ class JUnitFailureFactoryTest
private final JUnitFailureFactory factory = new JUnitFailureFactory();

@Test
void testCreateFailure_withMessageOnly_returnsAssertionFailedError()
void testCreateFailure_withMessageOnly_returnsDbAssertionFailedError()
{
final String message = "simple failure";

final Error error = factory.createFailure(message);

assertThat(error).as("error type.").isInstanceOf(AssertionFailedError.class);
assertThat(error).as("error type.").isInstanceOf(DbAssertionFailedError.class);
assertThat(error.getMessage()).as("message.").isEqualTo(message);
}

Expand Down
Loading
Loading