Fix MockitoMockMaker throws NPE on null object#2338
Fix MockitoMockMaker throws NPE on null object#2338AndreasTu merged 1 commit intospockframework:masterfrom
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR prevents a NullPointerException when mock-makers receive a null object by adding Changes
Sequence Diagram(s)sequenceDiagram
participant Test
participant MockMakerRegistry
participant MockitoMockMaker
participant MockitoImpl
Test->>MockMakerRegistry: call asMockOrNull(object)
alt object is null
MockMakerRegistry-->>Test: return null
else object non-null
MockMakerRegistry->>MockitoMockMaker: asMockOrNull(object)
alt impl is null
MockitoMockMaker-->>MockMakerRegistry: return null
else impl present
MockitoMockMaker->>MockitoImpl: getHandler(object)
MockitoImpl-->>MockitoMockMaker: handler / null
MockitoMockMaker-->>MockMakerRegistry: IMockObject / null
end
end
MockMakerRegistry-->>Test: IMockObject / null
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
MockMakerRegistry.asMockOrNull() shall return null on null object and not call the mock makers. Fixes spockframework#2337
✅ All tests passed ✅Test Summary
🏷️ Commit: 012cd4e Learn more about TestLens at testlens.app. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2338 +/- ##
============================================
- Coverage 82.22% 82.16% -0.07%
+ Complexity 4826 4824 -2
============================================
Files 472 472
Lines 15038 15040 +2
Branches 1907 1908 +1
============================================
- Hits 12365 12357 -8
- Misses 1985 1991 +6
- Partials 688 692 +4
🚀 New features to boost your workflow:
|
MockMakerRegistry.asMockOrNull() shall return null on null object and not call the mock makers.
Fixes #2337
Summary by CodeRabbit
Bug Fixes
Tests
Documentation