The problem only occurs when I am trying to debug a test via the IntelliJ debugger. It does not happen when I just simply run the test.
CustomerChoiceRepository is a normal Spring Boot JPA repository which here is being mocked with @Mock
.
When this line executes in the debugger I get the following error in the watch section of the variables:
The entire error message is:
Method threw 'org.mockito.exceptions.misusing.UnfinishedStubbingException' exception. Cannot evaluate com.item.repository.jpa.CustomerChoiceRepository$MockitoMock$1318657964.toString()
Again this is only is detected in the IntelliJ debugger, as a result the test fails only when I am debugging it.
So my question is: what is happening here?
Is this a bug ? Is this something that I fail to understand because I do not know the internals of Mockito particularly well ?