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
Class not prepared for test - even though it is. #1030
Comments
I have this same problem. |
Even I am facing a similar error. (This has happened after moving from Powermock 1.6 to 2.0 |
I am facing a similar error on mocking static methods, Using 2.0.2 with JUnit 5. |
I just encountered this issue as well just now. Stumbled here in the process of looking for solution |
Same issue here |
+1 |
Also experiencing the issue |
Facing the same issue...
|
Looked into the code and I don't really understand the point of the following line (
|
I get the same error while migrating from Java 8 to Java 11 |
+1 |
This is a JUnit 5 Test. Currently PowerMock does not support it. |
same issue, please solve it. |
Add junit-vintage-engine dependency if you are using junit 5. |
it's been a while .. any resolution ? |
I have the same problem. Are there any news about it? |
@MaxHo1234 you found something? |
Same problem. |
Same issue, do we have any solution for this ? |
Same issue. Pls fix it. Using powermock-junit4 1.6.6 |
Same issue. Any update/ workaround here? |
https://www.programmersought.com/article/18735574288/ extends PowerMockTestCase
|
I am facing the same issue with a JUnit 4 test, any solution ? |
I got it working by doing the following: Dependencies:
Test Class:
Also add the following to the following file: File:
Line:
|
What about extending the class with |
+1 |
Sorry folks, I haven't even touched this test suite in years. Hope these solve someone else's problem but I'm not gonna check it 😆 |
use@RunWith(PowerMockRunner.class),not @RunWith(RobolectricTestRunner.class),can solve this. |
Add class to @PrepareForTest() |
This resolved the issue for me. |
What steps will reproduce the problem?
Run this example:
Where the BackgroundMusicManager.java contains this, amongst other things:
What is the expected output?
I expect the test to run at least.
What do you see instead?
Where
line 31: mockStatic(BackgroundMusicManager.class);
What version of the product are you using? 2.0.4
The text was updated successfully, but these errors were encountered: