'Mockito+Kotlin+SpringBoot, `when` section doesn't mock, but invoke method meant to be mocked
I'm trying to modify existing test of kotlin+springboot project.
Mockito.`when`(serviceA.getData(anyString())).thenReturn(data)// existing mocking
Mockito.`when`(serviceB.getUserId()).thenReturn(userUuid.toString())// my mocking
both serviceA and serviceB are mocks, created in same way,
but behave differebtly. I placed break points in ServiceA.getData and ServiceB.getUserId methods. So when i run test in debug mode Mockito.when for ServiceA.getData expectedly doesn't invoke ServiceA.getData method, while Mockito.when(serviceB.getUserId()) unexpectedly calls ServiceB.getUserId - i see it in invokations stack and code stops at break point in this method.
Never met this in java, so what am i doing wrong? Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
