Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Add Support for @MockBean #975

Closed
eiswind opened this issue Aug 17, 2021 · 3 comments
Closed

Add Support for @MockBean #975

eiswind opened this issue Aug 17, 2021 · 3 comments
Labels
status: blocked An issue that's blocked on an external project change or another issue

Comments

@eiswind
Copy link

eiswind commented Aug 17, 2021

When I try to run a test, that uses @MockBean I get

com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.mockito.plugins.PluginSwitch] not found. Generating proxy classes at runtime is not supported.

I could not figure out how to allow the proxy manually, but I also think it would be helpful if spring native would support this ootb.

I created a little sample that reproduces the problem at https://github.com/eiswind/mockbean-spring-native

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 17, 2021
@sdeleuze
Copy link
Contributor

Hi, as documented:

Libraries generating bytecode at runtime like Mockito are not supported.

This kind of use case needs to be solved on GraalVM side before we can support it here, so maybe raise an issue asking Mockito support in https://github.com/graalvm/native-build-tools on tooling side where there is support for tests in order to allow us to have a look with GraalVM team.

@sdeleuze sdeleuze added status: blocked An issue that's blocked on an external project change or another issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 17, 2021
@eiswind
Copy link
Author

eiswind commented Aug 26, 2021

Thanks for clearing that up. As of the last few days mockito added a new feature called proxy-mock-maker that allows for using jdk proxies only. I still fail to make it compile as the NativeHints seem not to apply for the Unit Test.

I think this could be a great addition to to native feature set still, so I hope you'll give it a shot.
The example still lives in the mentioned repo.

@haroldlbrown
Copy link

It seems to me that GraalVM is now supported by Mockito and that GraalVM in turn supports Mockito.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: blocked An issue that's blocked on an external project change or another issue
Development

No branches or pull requests

4 participants