Repository navigation
Fixes #2399 : Adds defaultAnswer to the MockitoMockKey to distinguish the mock types, i.e. to separate mocks from spies otherwise spy type is reused for a mock or vice versa. - #2400
Conversation
…inguish the mock types, i.e. to separate mocks from spies otherwise spy type is reused for a mock or vice versa.
TimvdLippe
left a comment
There was a problem hiding this comment.
Nice find, fix and tests! 🎉
|
Ah, you will need to run |
|
@TimvdLippe Pushed formatting fixes. |
|
That's a bad patch, I'm afraid. I also see that this created an inconsistency for the inline and subclass mock makers. I am not entirely sure why this restriction was ever introduced in Mockito, but if we want to remove it, we would need to remove it generally, not for spies only. |
|
Oof, that's definitely on me for not fully understanding the domain space. Thanks Rafael for the additional knowledge, that was not something I was aware of. Reverting all the fixes seems like the right course of action at this point in time, to avoid further snowballing. I still think the intent of #2331 is good (it caught numerous bad tests at Google), so I would like to figure out an alternative solution that does not have the downsides of the existing implementation. |
Checklist
including project members to get a better picture of the change
commit is meaningful and help the people that will explore a change in 2 years
Fixes #<issue number>in the description if relevantFixes #<issue number>if relevant