Skip to content

Add @DbUnitRowCountCheck annotation for the row count check feature #945

Description

@jeffjensen

Fronts the row count check feature delivered in #939 with a declarative annotation,
following the same class/method precedence as the rest of the #753 annotation family.

Ask

Add @DbUnitRowCountCheck, a class- and method-level annotation that enables or
disables the row count check (#939) and configures its exclude list, without
touching DatabaseConfig directly:

  • enabled (default true when the annotation is present) turns the check on for
    the annotated scope, overriding whatever DatabaseConfig.FEATURE_ROW_COUNT_CHECK
    or the dbunit.rowCountCheck.enabled system property says.
  • exclude sets the table-name exclude patterns for that scope, replacing (not
    merging with) any class-level exclude when declared at the method level - method
    overrides class the same way the rest of the Add dbUnit annotations for declarative test setup, verification, and configuration #753 family works.
  • Method-level annotation overrides class-level; declaring neither leaves
    DatabaseConfig/system-property precedence untouched.

Wires into DbUnitExtension (JUnit 5/6): captures the row-count baseline in
beforeTestExecution(), verifies it in afterTestExecution(), and skips the verify
when the test itself already failed so the check never masks the real failure.

Notes

Depends on #939 (the row count check feature itself) and #753 (the annotation
vocabulary and execution model this plugs into).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: annotationsdbUnit annotations for test configuration

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions