-
Notifications
You must be signed in to change notification settings - Fork 586
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
version 1.7.0RC2 IllegalAccessError #753
Comments
Which version of mockito do you use? |
I'm using version 2.7.5 of mockito ! |
Thank you for reporting the issue. I'll look into. @gstamac, maybe you will have a time to check the issue. |
The problem occurs because you cannot directly instantiate DoesNothing class. The constructor is set to private. This would need to change to call the static method to get an instance. The following method currently looks like this:
but it should be changed to:
|
@emmaLP, thank you for investigating the issue. It will be amazing if you have a time to provide a pull request with changes. |
…ersions of Mockito - Updated the Mockito version to a more later version - Fixed issues with imports -Updated version to 1.7.0RC4
Pull request: #759 |
…f Mockito - Updated the Mockito version to a more later version - Fixed issues with imports -Updated version to 1.7.0RC4
@emmaLP, thank you a lot for help! I've merged your pull request. |
Do you have an ETA of when this will be released? |
I'll release it on Sunday.
Best regrads,
Arthur Zagretdinov
On 2 Mar 2017, at 08:51, emmaLP <[email protected]<mailto:[email protected]>> wrote:
Do you have an ETA of when this will be released?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub<#753 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMkKAPkv63zv-oP1NISSsghqMNiMgYGqks5rhnTmgaJpZM4MBjYc>.
|
powermock#753 issue fix to upgrade code to be compatible with later versions o…
@emmaLP, I've just dropped PowerMock 1.7.0.RC4 release. |
@thekingnothing You are a life saver. |
I use powermockito for mocking private method.
My test class has following annotations :
@RunWith( PowerMockRunner.class ) @PrepareForTest( DocumentsService.class )
My Test method has following code:
My test pass with 1.6.6 but not with 1.7.0RC2
Here is the stack trace of the error:
java.lang.IllegalAccessError: tried to access method org.mockito.internal.stubbing.answers.DoesNothing.<init>()V from class org.powermock.api.mockito.PowerMockito at org.powermock.api.mockito.PowerMockito.doNothing(PowerMockito.java:743) at fr.myPackage.shouldGenerateOnePDF(DocumentsServiceTest.java:219) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:68) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:310) at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:89) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:97) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:294) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:131) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.access$100(PowerMockJUnit47RunnerDelegateImpl.java:59) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner$TestExecutorStatement.evaluate(PowerMockJUnit47RunnerDelegateImpl.java:147) at org.assertj.core.api.JUnitSoftAssertions$1.evaluate(JUnitSoftAssertions.java:44) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.evaluateStatement(PowerMockJUnit47RunnerDelegateImpl.java:107) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:82) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:282) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:87) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:50) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:202) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:144) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:118) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:120) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:121) at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53) at org.powermock.modules.junit4.PowerMockRunner.run(PowerMockRunner.java:59) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
The text was updated successfully, but these errors were encountered: