-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Hey Mockito team,
I'm working on a project where we've dropped the usage of PowerMock in favour of mockStatic
from mockito-inline
but unfortunately this has led to an issue.
The issue seems to be the same as #2204. An outcome of that issue was the following test: https://github.com/mockito/mockito/blob/main/subprojects/groovyTest/src/test/groovy/org/mockito/groovy/GroovyMockitoTest.groovy
I've copied this into my project and this test is actually failing. I can make the test pass by replacing the dependency of mockito-inline
with mockito-core
but then I'd lose the ability to mock static/finals.
Versions:
- Groovy 3.0.9
- Mockito 4.2.0
- JUnit 4.13.1
The output of the failing test:
java.lang.NullPointerException
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:38)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
at demo.GroovyMockitoTest$ClassUnderTest.methodUnderTest(test.groovy:36)
at demo.GroovyMockitoTest$ClassUnderTest$methodUnderTest.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
Here is the failing test isolated in a small Gradle project: https://github.com/stevegreenn/mockito-inline-issue
Any ideas?
Many thanks,
Steve