Reputation: 36976
I have following code line:
when(htmlEmailSpy.setFrom(anyString())).thenReturn(null);
Following code executes real htmlEmailSpy.setFrom(...)
but it throws exception.
@Spy
HtmlEmail htmlEmailSpy = new HtmlEmail();
What do I wrong?
my aim - set new behaviour to spy object.
Upvotes: 0
Views: 299
Reputation: 36976
I have resolved problem:
doReturn(null).when(htmlEmailSpy).setFrom(anyString());
took from: Mockito: Trying to spy on method is calling the original method
Upvotes: 2