Skip to content

Commit 44a2228

Browse files
jeffjensenclaude
andcommitted
test(operation): Replace InsertOperationIT's inline HSQLDB-only assumeTrue with @EnabledIfSystemProperty
testExecute_withDefaultValueNotNullColumnTurningNull_appliesDefaultOnSecondRow only runs against HSQLDB, since DEFAULT_VALUE_TABLE is defined solely in that profile's fixture DDL. It expressed that as an inline runtime check: Assumptions.assumeTrue( _connection.getConnection().getMetaData() .getDatabaseProductName().startsWith("HSQL"), ...); Replace it with a method-level @EnabledIfSystemProperty(named = "dbunit.profile", matches = "hsqldb") annotation, matching the class-level precedent already used elsewhere in this suite (InsertIdentityOperationIT, PostgresqlUuidIT, PostgresSQLOidIT, SQLHelperDomainPostgreSQLIT). Drop the now-unused Assumptions import. Behavior unchanged: verified the target test still runs for real on hsqldb-2-7 and is cleanly disabled on h2-1-4. Found while surveying the codebase for the same in-test special-case-logic pattern addressed in #831/PR #834. This one doesn't fit that PR's dbunit.profile.unsupportedFeatures/TestFeature mechanism, since it's an inclusion check (only-HSQLDB) rather than an exclusion list, but the underlying goal is the same: replace an inline runtime database check with declarative JUnit config. Refs: 835 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fr791v2SnTRnyb1eU7LNB
1 parent 1e00a90 commit 44a2228

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/changes/changes.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</properties>
1414

1515
<body>
16-
<release version="3.4.0-SNAPSHOT" date="TBD" description="Un-skip and strengthen remaining disabled and no-op tests: implement DefaultPrepAndExpectedTestCaseTest stubs, convert ForwardOnlyDataSetTest no-ops to assertThrows, implement ExcludeTableFilterTest reverse-order tests, relocate ToStringViewTest's package-blocked cases, restore commented-out unit tests in CsvParserTest/FlatXmlTableTest/BiDirectionalEdgesDepthFirstSearchTest, implement ReplacementTableTest.testGetMissingValue, add assertions to applyColumnFilters tests, fix DatabaseTestCase tear-down exceptions obscuring test failures, rewrite obsolete DbUnitTaskIT queryset test, delete two dead commented-out test fragments, stop swallowing failures in PostgreSQL xtest* methods, add CachingConnectionProvider for opt-in IDatabaseConnection reuse across test methods, reduce DefaultPrepAndExpectedTestCase's per-test connection churn, fix DefaultPrepAndExpectedTestCase.runTest() losing a test failure to a cleanup exception, fix DefaultPrepAndExpectedTestCase column-name matching under non-English default locales, harmonize DefaultPrepAndExpectedTestCase's null-databaseTester handling on IllegalStateException, apply code-quality cleanups to DefaultPrepAndExpectedTestCase, pin remaining identifier case folding to Locale.ENGLISH for Turkish-family default locales, fix NullPointerException exporting NO_VALUE cells to flat XML and YAML dumping the raw sentinel, fix SQLHelper's schema-correction notice being silently dropped by a guard/call level mismatch, close BytesDataType file/URL streams and read them in chunks, fail fast on invalid BytesDataType [text]/[base64] values instead of silently storing garbage or NULL, fix QualifiedTableName escaping a single-character segment before a dot as part of the next segment, fix the Ant export step rejecting an uppercase CSV format and leaving an empty output file for unsupported formats, preserve the verify failure as suppressed when DefaultPrepAndExpectedTestCase.postTest's cleanup also fails, fix InsertOperation binding NULL into NOT NULL DEFAULT columns depending on row order, round-trip supplementary characters and replace unrepresentable control characters with U+FFFD in XML export, fix TimestampDataType mis-encoding pre-epoch fractional-second timestamps with a timezone suffix, roll back TransactionOperation on Error instead of implicitly committing, fix XlsTable negative row count and missing-row NullPointerException, pin YAML/DTD/OracleXMLType writer charsets to UTF-8 matching their readers, skip a redundant per-table metadata query in DatabaseDataSet.getTableMetaData, guard or remove per-cell debug logging in the datatype package, fix a data race that could mask the real producer failure in StreamingIterator, fix CsvParser duplicating the continuation line on a short multi-line parse, use DatabaseConfig.getFeature for the qualified-table-names check in DatabaseDataSet, fix FileHelper.copyFile leaking the source stream when the destination cannot be opened, keep DefaultPrepAndExpectedTestCase.configureTest's connection open for the test lifecycle instead of closing and immediately reacquiring it, remove a dead field and harden the close path in RefreshOperation, route Base64's stderr diagnostics through slf4j, remove XmlWriter's dead setEncoding(String) overload, fix CsvProducer truncating table names containing .csv before the final suffix, remove unused duplicate slf4jVersion/snakeYamlVersion pom properties, fix SQLHelper.logDebugIfValueChanged brace indentation, centralize duplicated Turkish-locale test setup into a shared @TurkishDefaultLocale JUnit 5 extension, fix TimestampDataType writing the wrong instant to TIMESTAMP WITH TIME ZONE columns when some JDBC drivers tag the value with the JVM's default time zone instead of the dataset's own time zone">
16+
<release version="3.4.0-SNAPSHOT" date="TBD" description="Un-skip and strengthen remaining disabled and no-op tests: implement DefaultPrepAndExpectedTestCaseTest stubs, convert ForwardOnlyDataSetTest no-ops to assertThrows, implement ExcludeTableFilterTest reverse-order tests, relocate ToStringViewTest's package-blocked cases, restore commented-out unit tests in CsvParserTest/FlatXmlTableTest/BiDirectionalEdgesDepthFirstSearchTest, implement ReplacementTableTest.testGetMissingValue, add assertions to applyColumnFilters tests, fix DatabaseTestCase tear-down exceptions obscuring test failures, rewrite obsolete DbUnitTaskIT queryset test, delete two dead commented-out test fragments, stop swallowing failures in PostgreSQL xtest* methods, add CachingConnectionProvider for opt-in IDatabaseConnection reuse across test methods, reduce DefaultPrepAndExpectedTestCase's per-test connection churn, fix DefaultPrepAndExpectedTestCase.runTest() losing a test failure to a cleanup exception, fix DefaultPrepAndExpectedTestCase column-name matching under non-English default locales, harmonize DefaultPrepAndExpectedTestCase's null-databaseTester handling on IllegalStateException, apply code-quality cleanups to DefaultPrepAndExpectedTestCase, pin remaining identifier case folding to Locale.ENGLISH for Turkish-family default locales, fix NullPointerException exporting NO_VALUE cells to flat XML and YAML dumping the raw sentinel, fix SQLHelper's schema-correction notice being silently dropped by a guard/call level mismatch, close BytesDataType file/URL streams and read them in chunks, fail fast on invalid BytesDataType [text]/[base64] values instead of silently storing garbage or NULL, fix QualifiedTableName escaping a single-character segment before a dot as part of the next segment, fix the Ant export step rejecting an uppercase CSV format and leaving an empty output file for unsupported formats, preserve the verify failure as suppressed when DefaultPrepAndExpectedTestCase.postTest's cleanup also fails, fix InsertOperation binding NULL into NOT NULL DEFAULT columns depending on row order, round-trip supplementary characters and replace unrepresentable control characters with U+FFFD in XML export, fix TimestampDataType mis-encoding pre-epoch fractional-second timestamps with a timezone suffix, roll back TransactionOperation on Error instead of implicitly committing, fix XlsTable negative row count and missing-row NullPointerException, pin YAML/DTD/OracleXMLType writer charsets to UTF-8 matching their readers, skip a redundant per-table metadata query in DatabaseDataSet.getTableMetaData, guard or remove per-cell debug logging in the datatype package, fix a data race that could mask the real producer failure in StreamingIterator, fix CsvParser duplicating the continuation line on a short multi-line parse, use DatabaseConfig.getFeature for the qualified-table-names check in DatabaseDataSet, fix FileHelper.copyFile leaking the source stream when the destination cannot be opened, keep DefaultPrepAndExpectedTestCase.configureTest's connection open for the test lifecycle instead of closing and immediately reacquiring it, remove a dead field and harden the close path in RefreshOperation, route Base64's stderr diagnostics through slf4j, remove XmlWriter's dead setEncoding(String) overload, fix CsvProducer truncating table names containing .csv before the final suffix, remove unused duplicate slf4jVersion/snakeYamlVersion pom properties, fix SQLHelper.logDebugIfValueChanged brace indentation, centralize duplicated Turkish-locale test setup into a shared @TurkishDefaultLocale JUnit 5 extension, fix TimestampDataType writing the wrong instant to TIMESTAMP WITH TIME ZONE columns when some JDBC drivers tag the value with the JVM's default time zone instead of the dataset's own time zone, replace InsertOperationIT's inline HSQLDB-only assumeTrue check with @EnabledIfSystemProperty">
1717
<action dev="jeffjensen" type="test" issue="797" system="github" due-to="jeffjensen">
1818
Implement the 8 empty, @Disabled DefaultPrepAndExpectedTestCaseTest stub methods covering preTest, postTest, setupData, verifyData, cleanupData, and makeCompositeDataSet, using the class's existing Mockito-based connection harness. Move the test fixture's databaseTester/tc construction from field initializers to a @BeforeEach method so @Mock injection (MockitoExtension) completes before they are built.
1919
</action>
@@ -155,6 +155,9 @@
155155
<action dev="jeffjensen" type="fix" issue="831" system="github" due-to="yoshida16729438">
156156
Fix TimestampDataType writing the wrong instant to TIMESTAMP WITH TIME ZONE columns: the issue #711 fix's Calendar-based setTimestamp(Timestamp, Calendar) call let some JDBC drivers tag the stored value with the JVM's default time zone instead of the dataset's own time zone, silently discarding it. Detect such columns via PreparedStatement.getParameterMetaData() and write them with setObject(OffsetDateTime) instead, which drivers supporting the SQL type map unambiguously; columns without a time zone keep the existing Calendar-based behavior from #711 unchanged.
157157
</action>
158+
<action dev="jeffjensen" type="test" issue="835" system="github" due-to="jeffjensen">
159+
Replace InsertOperationIT's inline getDatabaseProductName()-based assumeTrue check, gating a test to HSQLDB only since DEFAULT_VALUE_TABLE is defined solely in its fixture DDL, with a method-level @EnabledIfSystemProperty(named = "dbunit.profile", matches = "hsqldb") annotation, matching existing class-level precedent elsewhere in the test suite.
160+
</action>
158161
</release>
159162
<release version="3.3.0" date="Jul 22, 2026" description="Performance improvements and fixes: speed up column index lookups, suppress RowOutOfBoundsException stack traces, buffer XML, CSV, DTD, and YAML output, cache DecimalFormat in XlsTable, restore DepthFirstSearch tests, fix DepthFirstSearch depth limit, cache DatabaseSequenceFilter dependency edges, topological sort in DatabaseSequenceFilter, single column-metadata fetch in ResultSetTableMetaData, precompute sort keys in SortedTable, reduce assertion loop overhead, reduce ReplacementTable scanning, flatten CompositeDataSet table merging, detect columns without exception flow in FlatXmlProducer, fix PrimaryKeyFilter result set leak, fix XlsDataSetWriter memory leak, skip timezone regex for plain timestamps, guard hot-path debug logging, fix SQLHelper result set leak, reuse query metadata in QueryTableIterator, fix XlsDataSet file stream leak, release consumed CSV rows early, lookup map for OrderedTableNameMap original names, primitive row index storage in RowFilterTable, set-based membership in Columns.mergeColumnsByName, extend ResultSetTableMetaData column-metadata cache to MySqlMetadataHandler and Db2MetadataHandler, fix XlsDataSetWriter StringIndexOutOfBoundsException for BigDecimal scale greater than 52, restore execution of 45 test methods silenced by missing @Test annotations, fix corrupted assertion in HandlersTest">
160163
<!-- dependabot:dep=actions/checkout:new=7:pr=756 -->

src/test/java/org/dbunit/operation/InsertOperationIT.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
4545
import org.dbunit.dataset.xml.XmlDataSet;
4646
import org.dbunit.testutil.TestUtils;
47-
import org.junit.jupiter.api.Assumptions;
4847
import org.junit.jupiter.api.Test;
48+
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
4949

5050
/**
5151
* @author Manuel Laflamme
@@ -335,16 +335,12 @@ void testExecute_emptyStringWithAllowEmptyFields_insertedAsEmptyString() throws
335335
}
336336

337337
@Test
338+
@EnabledIfSystemProperty(named = "dbunit.profile", matches = "hsqldb")
338339
void testExecute_withDefaultValueNotNullColumnTurningNull_appliesDefaultOnSecondRow()
339340
throws Exception
340341
{
341342
// DEFAULT_VALUE_TABLE (ID, STATUS NOT NULL DEFAULT 'PENDING') is
342343
// only defined in the HSQLDB fixture DDL.
343-
Assumptions.assumeTrue(
344-
_connection.getConnection().getMetaData()
345-
.getDatabaseProductName().startsWith("HSQL"),
346-
"Skip: DEFAULT_VALUE_TABLE is only defined in the HSQLDB fixture DDL.");
347-
348344
final String tableName = "DEFAULT_VALUE_TABLE";
349345
final Column[] columns = {new Column("ID", DataType.INTEGER),
350346
new Column("STATUS", DataType.VARCHAR,

0 commit comments

Comments
 (0)