Skip to content
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

PowerMockMaker with Mockito2 #769

Closed
podarsmarty opened this issue Mar 24, 2017 · 0 comments
Closed

PowerMockMaker with Mockito2 #769

podarsmarty opened this issue Mar 24, 2017 · 0 comments

Comments

@podarsmarty
Copy link
Contributor

podarsmarty commented Mar 24, 2017

Until we fully move from CGLIB to Byte Buddy we should let the user choose to not use the PowerMockMaker for certain mocks. This would be extremely helpful for tests that do not require PowerMock to still take advantage of Mockito2 features such as mocking public methods of a non-public parent class while still allowing tests in the project to leverage PowerMock.

I think we should use implement a mockito PluginSwitch which allows the user to turn off/on the PowerMockMaker plugin temporarily. This, however, is not currently possible as we are unable to tell mockito to reload plugins after the PluginSwitch updates state due to the registry being final. Will update with mockito ticket (edit: mockito/mockito#1003). While this is not done yet, we can work around it by putting this switch inside of PowerMockMaker.

What steps will reproduce the problem?

  • Try to mock out a public method in a non-public parent class.
    What is the expected output?
  • Method to be mocked.
    What do you see instead?
  • mockito exception due to PowerMockMaker still using cglib.
    What version of the product are you using?
  • 1.7.0RC4
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

No branches or pull requests

2 participants