Skip to content

Conversation

mlichtblau
Copy link
Contributor

Fixes #2686
This PR adds a test which is expected to pass.
Without the change to TriesToReturnSelf it throws a java.lang.ClassCastException.

org.mockitousage.stubbing.StubbingReturnsSelfTest > should_not_fail_when_calling_method_with_generic_return_type FAILED
    java.lang.ClassCastException: class org.mockitousage.stubbing.StubbingReturnsSelfTest$Builder$MockitoMock$idXgt9U6 cannot be cast to class java.lang.String (org.mockitousage.stubbing.StubbingReturnsSelfTest$Builder$MockitoMock$idXgt9U6 is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
        at org.mockitousage.stubbing.StubbingReturnsSelfTest.should_not_fail_when_calling_method_with_generic_return_type(StubbingReturnsSelfTest.java:80)

@codecov-commenter
Copy link

Codecov Report

Merging #2687 (8a53c3e) into main (ec27830) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##               main    #2687   +/-   ##
=========================================
  Coverage     86.26%   86.26%           
- Complexity     2776     2780    +4     
=========================================
  Files           315      315           
  Lines          8334     8334           
  Branches       1037     1035    -2     
=========================================
  Hits           7189     7189           
  Misses          874      874           
  Partials        271      271           
Impacted Files Coverage Δ
...nal/stubbing/defaultanswers/TriesToReturnSelf.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec27830...8a53c3e. Read the comment docs.

Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes a lot of sense, nice fix!

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.

RETURNS_SELF breaks methods with generic return type

3 participants