mockito WrongTypeOfReturnValue cannot be returned by toString() toString() should return String code example
Example: org.mockito.exceptions.misusing.WrongTypeOfReturnValue
//use
doReturn(fooBar).when(bar).getFoo()
//instead of
when(bar.getFoo()).thenReturn(fooBar)