intellij-platform-gradle-plugin
intellij-platform-gradle-plugin copied to clipboard
Mockito Tests not work after updating to 1.9.0
Describe the bug
A clear and concise description of what the bug is.
Add the full stack trace if available.
If possible, run the failing task with --stacktrace flag.
Mockito cannot mock/spy because :
- final class
To Reproduce see failed action https://github.com/MCMicS/jenkins-control-plugin/runs/8199874953?check_suite_focus=true
Expected behavior Test will be executed like in version 1.8.1
Please replace your MockMaker config file:
jenkins-control-plugin/src/test/resources/mockito-extensions(simply remove it)
with the mockito-inline artifact:
- replace
'org.mockito:mockito-core:4.7.0'with'org.mockito:mockito-inline:4.7.0'
See: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#mockito-inline
I'm not sure how the recent changes caused this issue, but I verified the solution, and it works properly.
thanks for the hint. with mockito-inline it works again.
The issue seems to be caused by this change:
- https://github.com/JetBrains/gradle-intellij-plugin/commit/47bbfbaa361714cfe19432350954fbac9389a210#diff-d7d397447dff9b82440110ee94dca3dda67b3f9449af7004a72a5f6ea99646beR1153
It pushes the resources directories from the build directory to the end of the test classpath, which results in loading org.mockito.plugins.MockMaker config from Power Mock, which is first in the classpath, so the project's org.mockito.plugins.MockMaker is ignored. It may cause more similar issues for other resources.