New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make MockUtil.getMockMaker() public or public Mockito API #3128
Comments
Yes I think that's fair to publicly expose, as users already interact with it via the resources. E.g. the names are already part of the public api there. |
AndreasTu
added a commit
to AndreasTu/mockito
that referenced
this issue
Oct 5, 2023
The MockitoPlugins interface now provides access to the getMockMaker() method. Fixes mockito#3128
8 tasks
AndreasTu
added a commit
to AndreasTu/mockito
that referenced
this issue
Oct 5, 2023
The MockitoPlugins interface now provides access to the getMockMaker() method. Fixes mockito#3128
AndreasTu
added a commit
to AndreasTu/mockito
that referenced
this issue
Oct 5, 2023
The MockitoPlugins interface now provides access to the getMockMaker() method. Fixes mockito#3128
TimvdLippe
pushed a commit
that referenced
this issue
Oct 6, 2023
The MockitoPlugins interface now provides access to the getMockMaker() method. Fixes #3128
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Proposal:
Make the method
org.mockito.internal.util.MockUtil.getMockMaker(String)
public or better part of the public Mockito Plugin-API.The existing
org.mockito.plugins.MockitoPlugins.getInlineMockMaker()
creates a newmock-maker-inline
instance when called.Reason:
I am currently working on a PR for Spock, which integrates
Mockito
as a Mocking library into Spock for normal and static mocks.If I use the public API of
MockitoPlugins.getInlineMockMaker()
, the combination of Mockito and Spock with Mockito leads to strange behavior. E.g. If someone mocks the same static class with Mockito and Spock, themock-maker-inline
gets confused.The reasons for that is, that two Mockito
InlineDelegateByteBuddyMockMaker
instances try to transform static methods at the same time.If I use the
MockUtil.getMockMaker()
Spock with Mockito and Mockito will interop nicely with each other and report an error, if the same class is mocked twice.So the user can use Mockito-API in Spock-Tests and also Spock-API, which uses Mockito under the hood.
The text was updated successfully, but these errors were encountered: