Skip to content

Fix 6 issues in AssertJ recipe migrations#911

Merged
timtebeek merged 5 commits intomainfrom
timtebeek/review-feedback
Feb 13, 2026
Merged

Fix 6 issues in AssertJ recipe migrations#911
timtebeek merged 5 commits intomainfrom
timtebeek/review-feedback

Conversation

@timtebeek
Copy link
Member

Summary

Fixes 6 compile errors from the AssertJ best practices recipe when run on Apache SkyWalking:

  • Issue 1: assertThat(Object) ambiguity — add (Object) cast when actual type is java.lang.Object
  • Issue 2: UseAssertSame incorrectly converts null comparisons like assertTrue(x != null) to assertNotSame(x, null)
  • Issue 4: isCloseTo type mismatch when actual is integral but delta is floating-point
  • Issue 5: SimplifyChainedAssertJAssertion with Map<String, ?> wildcard types
  • Issue 7: hasSize(1L) converts long literal to int parameter
  • Issue 8: JUnitAssertThrowsToAssertExceptionType imports from wrong class

Test Plan

  • All 4 affected test classes pass with 100% success rate (55 total tests)
  • Added 6 new tests covering the fixed issues
  • Verified no regressions in existing tests

🤖 Generated with Claude Code

Fixes the following compile errors from AssertJ best practices recipe:

- Issue 1: assertThat(Object) ambiguity — cast to (Object) when actual type is java.lang.Object
- Issue 2: UseAssertSame incorrectly converts null comparisons (x != null) to assertNotSame(x, null)
- Issue 4: isCloseTo type mismatch when actual is integral but delta is floating-point
- Issue 5: SimplifyChainedAssertJAssertion with Map<String, ?> wildcard types
- Issue 7: hasSize(1L) converts long literal to int parameter
- Issue 8: JUnitAssertThrowsToAssertExceptionType imports from wrong class (AssertionsForClassTypes)

All 6 fixes are covered with new tests that verify the corrections work as expected.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@timtebeek timtebeek merged commit 9afa99f into main Feb 13, 2026
1 check passed
@timtebeek timtebeek deleted the timtebeek/review-feedback branch February 13, 2026 12:33
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Feb 13, 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

Comments