tried
doAnswer(new Answer<String>() {
@Override
public String answer(InvocationOnMock invocation) throws Throwable {
return "String";
}
}).when(object).voidMethod();
Assert.assertEquals("String",object.voidMethod());
and
doReturn("String").when(object.voidMethod())
but this not works because voidMethod() is void. Is any variants not to use doThrow()?
Aucun commentaire:
Enregistrer un commentaire