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

Add support for Mockito #1063

Closed
eiswind opened this issue Sep 23, 2021 · 4 comments
Closed

Add support for Mockito #1063

eiswind opened this issue Sep 23, 2021 · 4 comments
Labels
status: blocked An issue that's blocked on an external project change or another issue

Comments

@eiswind
Copy link

eiswind commented Sep 23, 2021

Mockito has a new feature that allows disabling byte code generation and working with jdk proxies instead (of course limited to interfaces)

It has to be activated by creating a file called

mockito-extensions/org.mockito.plugins.MockMaker

with a content of

mock-maker-proxy

I seriously tried to make this work, but it seems like the typehints do not count for test classes.

Do you think this could be an option to be supported?

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

Hey, thanks for raising this. For hints curious, they should.

But maybe you could first try to make a POC without Spring Native involved to check it works with GraalVM 21.2 + native build tools JUnit support? As a second step we could have a look on Spring side.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Sep 23, 2021
@eiswind
Copy link
Author

eiswind commented Sep 23, 2021

Ok, I'll see if I find some time tomorrow to get a working setup. I really would like to see this working.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 23, 2021
@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 status: feedback-provided Feedback has been provided labels Nov 3, 2021
@sdeleuze sdeleuze changed the title Add support for @MockBean with jdk proxies Add support for Mockito Dec 20, 2021
@sdeleuze sdeleuze added this to the Backlog milestone Dec 20, 2021
@sdeleuze
Copy link
Contributor

Mockito support need to be added at Spring AOT level, see related this related comment.

sdeleuze added a commit that referenced this issue Dec 20, 2021
Since Mockito Definition parameters are not supported yet
and Mockito unsupported on native for now (see gh-1063),
MockitoPostProcessor should be excluded in order to throw a more
meaningful "NoSuchBeanDefinitionException: No qualifying bean
of type 'MockitoPostProcessor' available" error rather than
the current "IllegalArgumentException: Code should not be empty"
one.

This commit also updates the support documentation to explicitly
mention that Mockito is unsupported at this stage.

Closes gh-1343
@sdeleuze
Copy link
Contributor

GraalVM team is working actively on that, so I close the issue on Spring Native side.

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

3 participants