Skip to content

Replace inline HSQLDB-only assumeTrue check in InsertOperationIT with @EnabledIfSystemProperty #835

Description

@jeffjensen

InsertOperationIT.testExecute_withDefaultValueNotNullColumnTurningNull_appliesDefaultOnSecondRow gates itself to HSQLDB only, since DEFAULT_VALUE_TABLE is defined solely in the HSQLDB fixture DDL, via an inline runtime check:

Assumptions.assumeTrue(
        _connection.getConnection().getMetaData()
                .getDatabaseProductName().startsWith("HSQL"),
        "Skip: DEFAULT_VALUE_TABLE is only defined in the HSQLDB fixture DDL.");

This codebase already has a cleaner, declarative way to express "this test only runs against database X": JUnit 5's @EnabledIfSystemProperty(named = "dbunit.profile", matches = "..."), already used at the class level in InsertIdentityOperationIT, PostgresqlUuidIT, PostgresSQLOidIT, and SQLHelperDomainPostgreSQLIT.

Replace the inline check with a method-level @EnabledIfSystemProperty(named = "dbunit.profile", matches = "hsqldb") annotation on the one affected test method, and drop the now-unused Assumptions import.

Found while surveying the codebase for the same in-test special-case-logic anti-pattern addressed in #831/PR #834 (there, ad-hoc exception-catching and runtime capability checks were replaced with declarative dbunit.profile.unsupportedFeatures / TestFeature config). This one doesn't fit that exact mechanism since it's an inclusion check (only-HSQLDB) rather than an exclusion list, but the underlying goal - replacing an inline runtime database check with declarative JUnit config - is the same.

Metadata

Metadata

Assignees

Labels

area: operationDatabaseOperation (INSERT, UPDATE, DELETE, REFRESH, etc.)type: testTest additions or fixes

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions