Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: reified mock overloads (#2882)
Added reified mock overload methods to match the methods that consume an explicit Class<T> object. The following methods have been added: - Mockito.<T>mock(String, T...) - Sets the mock name. - Mockito.<T>mock(Answer, T...) - Sets the default answer. - Mockito.<T>mock(WithSettings, T...) - Provides custom settings. I have also added a case where passing null varargs in would result in a NullPointerException previously. Now, it will tell the user that they should not be providing these varargs at all. These overloads should not conflict with any existing usages of this API in the intended way, as the assumption is that a user probably isn't going to want to be mocking Mockito internals, Strings, or WithSettings objects anyway. If they do need to achieve this, then this is still accessible via the existing Mockito.<T>mock(Class<T>) methods anyway.
- Loading branch information
Showing
2 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters