Cannot mock @Service annotated Kotlin class with member extension function that has generics [SPR-17128] #21665
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
in: kotlin
An issue in or related to Kotlin support
status: waiting-for-triage
An issue we've not yet triaged or decided on
s1monw1 opened SPR-17128 and commented
I was trying to mock a non-final, non-private Kotlin class with a simple
Mockito.mock()
call and got the following exception. Turns out, the problem is an embedded member extension function in combination with Spring'sService
annotation. See below for an example.Reproduce it with this simple Test:
Two ways to make it work:
@Service
and make the classopen
orfun String.x = "x"
Thanks in advance.
kotlin: '1.2.51'
springBoot: '2.0.3.RELEASE'
Affects: 5.0.7
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: