I'm working in a project which combines Spring Boot 3.4 with GraalVM native build, Jextract and Foreign Function & Memory API (Project Panama).
When I build and run my JUnit tests, it works in normal mode, but I can't make it work in native mode (Spring's "nativeTest" profile). The last error that I got was:
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
See a minimal reproducible example at https://github.com/rbarriuso/junit-native-sample
Full error at https://github.com/rbarriuso/junit-native-sample/blob/main/error.log
Comment From: bclozel
This looks quite similar to https://github.com/raphw/byte-buddy/issues/1603
Did find any information pointing to this being supported on GraalVM?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: rbarriuso
Thanks for the info @bclozel . To be honest I didn't know about this limitation. I thought it was rather related to using the "java.lang.foreign" API on tests.
I any case I think it's worth mentioning these kind of limitations in the Spring Boot how to: https://docs.spring.io/spring-boot/how-to/native-image/testing-native-applications.html
Comment From: philwebb
I'm not sure we should attempt to document Mockito limitations in our own docs since it will be hard for us to keep that information accurate going forward. I think the Mockito docs are the correct place for such limitations to be listed.