Skip to content

Comments

Add missing Hamcrest not(Matcher) to AssertJ conversions#917

Merged
timtebeek merged 1 commit intomainfrom
add-missing-not-matcher-entries
Feb 23, 2026
Merged

Add missing Hamcrest not(Matcher) to AssertJ conversions#917
timtebeek merged 1 commit intomainfrom
add-missing-not-matcher-entries

Conversation

@timtebeek
Copy link
Member

@timtebeek timtebeek commented Feb 23, 2026

Summary

  • Adds 7 missing HamcrestNotMatcherToAssertJ YAML entries for not() wrappers around matchers that already had positive-case support:

    • Map matchers: not(hasKey)doesNotContainKey, not(hasValue)doesNotContainValue, not(hasEntry)doesNotContainEntry, not(anEmptyMap)isNotEmpty
    • String matchers: not(isEmptyOrNullString)isNotEmpty, not(emptyOrNullString)isNotEmpty
    • Object matchers: not(isA)isNotInstanceOf
  • Adds parameterized tests for all new entries

  • Partially addresses org.openrewrite.java.testing.hamcrest.MigrateHamcrestToAssertJ Omission #866. Remaining items from that issue (not(contains(...)), MockitoHamcrest.argThat, hasSize(greaterThanOrEqualTo(...)), Description/BaseMatcher) require more involved changes.

Test plan

  • Added parameterized notMapReplacements tests for map matcher negations
  • Added entries to existing notReplacements tests for string/object matcher negations
  • All MigrateHamcrestToAssertJTest tests pass

Add 7 missing `HamcrestNotMatcherToAssertJ` entries for:
- Map matchers: `not(hasKey)`, `not(hasValue)`, `not(hasEntry)`, `not(anEmptyMap)`
- String matchers: `not(isEmptyOrNullString)`, `not(emptyOrNullString)`
- Object matchers: `not(isA)`
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Feb 23, 2026
@timtebeek timtebeek merged commit bf27539 into main Feb 23, 2026
1 check passed
@timtebeek timtebeek deleted the add-missing-not-matcher-entries branch February 23, 2026 20:40
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant