withObjectMocked leads to "java.lang.NoSuchFieldException: modifiers"
See original GitHub issueI’m using java 8 and scala 2.12.
Is withObjectMocked
supported in Java 8?
[info] java.lang.NoSuchFieldException: modifiers
[info] at java.base/java.lang.Class.getDeclaredField(Class.java:2412)
[info] at org.mockito.ReflectionUtils$.setFinalStatic(ReflectionUtils.scala:128)
[info] at org.mockito.MockitoEnhancer.withObjectMocked(MockitoAPI.scala:641)
[info] at org.mockito.MockitoEnhancer.withObjectMocked$(MockitoAPI.scala:630)
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
[Mockito][withObjectMocked]NoSuchFieldException: MODULE
I can't test a simple example of withObjectMocked, and I still get this exception : Caused by: java.lang.NoSuchFieldException: MODULE$.
Read more >[DISCUSS] Refactoring unit tests which changed modifiers of ...
Hi all Since the latest LTS Java 17 has been released, it's better to support ... It will cause `java.lang.NoSuchFieldException: modifiers`.
Read more >mockito mockito-scala Issues - Giters
mockito mockito-scala: Mockito for Scala language. ... withObjectMocked leads to "java.lang.NoSuchFieldException: modifiers". Updated 6 months ago 11 ...
Read more >[Mockito][withObjectMocked]NoSuchFieldException: MODULE
I can't test a simple example of anycodings_scala withObjectMocked, and I still get this anycodings_scala exception : Caused by: java.lang.
Read more >mockito-scala - Github Plus
withObjectMocked leads to "java.lang.NoSuchFieldException : modifiers". I'm using java 8 and scala 2.12. Is withObjectMocked supported in Java 8?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
temporary… I add vm option to my test. –add-opens java.base/java.lang=ALL-UNNAMED –add-opens java.base/java.lang.reflect=ALL-UNNAMED
it work for me!!
I’m seeing this using Java 8, Scala 2.12, mockito v1.17.0.