Skip to content

Add equivalence relation tests for FluentBitSet.equals()#1613

Closed
lmj798 wants to merge 1 commit intoapache:masterfrom
lmj798:master
Closed

Add equivalence relation tests for FluentBitSet.equals()#1613
lmj798 wants to merge 1 commit intoapache:masterfrom
lmj798:master

Conversation

@lmj798
Copy link

@lmj798 lmj798 commented Mar 5, 2026

Summary

Add boundary tests for FluentBitSet.equals() method to verify the
correct behavior of equivalence relation properties and edge cases
that are not covered by existing tests.

Why

Current tests cover basic equality and null comparisons, but do not
explicitly verify:

  • Reflexivity: a BitSet equals itself
  • Symmetry: if A.equals(B) then B.equals(A)
  • Transitivity: if A.equals(B) and B.equals(C) then A.equals(C)
  • Empty BitSet equality and hashCode consistency
  • Clone equality and hashCode preservation
  • Comparison with raw BitSet objects (should return false)
  • Partial overlapping scenarios
  • Same cardinality but different bit positions
    These boundary cases are easy to regress (for example, through
    off-by-one errors in bit comparison logic), so explicit tests
    improve behavioral stability.

Verification

Ran mvn -Dtest=FluentBitSetTest test
Result: all tests passed

@garydgregory
Copy link
Member

@lmj798
This seems to duplicate existing tests in a test that has 100% code coverage:

  • in the release, and
  • in git master:
image

@lmj798
Copy link
Author

lmj798 commented Mar 5, 2026

@lmj798 This seems to duplicate existing tests in a test that has 100% code coverage:

  • in the release, and
  • in git master:
image

Ah, I see. I missed that those cases were already covered by the existing suite. Thanks for pointing that out. I'll close this PR.

@lmj798 lmj798 closed this Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants