-
Notifications
You must be signed in to change notification settings - Fork 585
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Mockito mock-maker-inline does not work with Robolectric #811
Comments
@xian and @raphw could you help me to clarify the issue and current state with robolectric/robolectric#2761 PowerMock uses the following code to load
I guess that in this case Robolectric ClassLoader is used and everything should be fine. I'm not sure, but maybe correct way to load a class will be |
The inline Mock maker needs to load a class explicitly as it must inject a type into the bootstrap class loader. I guess some explicit class loading is triggering some code before the inline mock maker is loaded such that this yields a race? I am however confused over this mistake: Caused by: java.lang.NullPointerException Could you look at the line in question and debug what is missing? Are you running on a JDK? |
As I see in stacktrace it was OpenJDK
|
@raphw @thekingnothing Yes, it's OpenJDK because I'm using Robolectric |
did you ever solve this issue? |
PowerMock is supposed to solve the integration problem with Mockito mock-maker-inline. However, since it uses its custom PowerMockMaker, it cannot initialize Byte Buddy mock maker.
The problem is this one: "This mock maker is not supported on Android" when running side by side with Robolectric. It seems like Robolectric already solved this issue here: robolectric/robolectric#2761
Libraries used:
mockitoVersion -> 2.8.9
powermockVersion -> 1.7.0
robolectricVersion -> 3.4-rc2
When you try to mock a simple final class with the JUnit4 or PowerMock runners you can see this error:
The text was updated successfully, but these errors were encountered: