Skip to content

Fix Kotlin, JUnit , Mockito: @MockBean does not inject a mocked bean (#1275)#1369

Open
MariusVolkhart wants to merge 2 commits into
micronaut-projects:4.10.xfrom
MariusVolkhart:mv/methodInjectionPoint
Open

Fix Kotlin, JUnit , Mockito: @MockBean does not inject a mocked bean (#1275)#1369
MariusVolkhart wants to merge 2 commits into
micronaut-projects:4.10.xfrom
MariusVolkhart:mv/methodInjectionPoint

Conversation

@MariusVolkhart
Copy link
Copy Markdown
Contributor

MicronautJunit5Extension was not handling MethodInjectionPoints. Kotlin lateinit vars get turned into MethodInjectionPoints by KSP. Accordingly, these fields were not having their mocks aligned.

The MicronautSpockExtension already handled MethodInjectionPoint and was the blueprint for the JUnit implementation.

Fixes #1275

@MariusVolkhart
Copy link
Copy Markdown
Contributor Author

The Java CI failure appears to be due to missing credentials for Sonatype Scan. I'm afraid I don't understand the GraalVM 17 failure. It's in a module I didn't modify, and it appears to have failed several times in the past, though recent builds on the destination build have succeeded.

@altro3 altro3 mentioned this pull request Mar 1, 2026
@altro3
Copy link
Copy Markdown
Contributor

altro3 commented Mar 4, 2026

@MariusVolkhart mege branch 4.10.x, please

MariusVolkhart and others added 2 commits March 4, 2026 13:41
…icronaut-projects#1275)

MicronautJunit5Extension was not handling MethodInjectionPoints. Kotlin `lateinit var`s get turned into MethodInjectionPoints by KSP. Accordingly, these fields were not having their mocks aligned.

The MicronautSpockExtension already handled MethodInjectionPoint and was the blueprint for the JUnit implementation.

Fixes micronaut-projects#1275

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@MariusVolkhart MariusVolkhart force-pushed the mv/methodInjectionPoint branch from 4cdf263 to 969d137 Compare March 4, 2026 18:42
@MariusVolkhart
Copy link
Copy Markdown
Contributor Author

Rebase complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants