If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2004-01-14
In chapter 12, page 392-393: I am still unclear of the difference between the Mock.expectAndReturn() and Mock.matchAndReturn(). I looked through the javadocs for jMock and DynaMock but no explanation existed (just the method signature). Does anyone know where to locate more complete documentation on either of these frameworks ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
expectAndReturn() expects the call to be made and will generate an exception if the call doesn't happen before the verify() method on the mock is called. Also, you'll need as many expect calls as there are calls to the method mocked.
matchAndReturn() simply states to return such value whenever such method is called, whatever the number of times the method is called.
Thanks
-Vincent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Welcome to discuss
In chapter 12, page 392-393: I am still unclear of the difference between the Mock.expectAndReturn() and Mock.matchAndReturn(). I looked through the javadocs for jMock and DynaMock but no explanation existed (just the method signature). Does anyone know where to locate more complete documentation on either of these frameworks ?
Hi Ken,
expectAndReturn() expects the call to be made and will generate an exception if the call doesn't happen before the verify() method on the mock is called. Also, you'll need as many expect calls as there are calls to the method mocked.
matchAndReturn() simply states to return such value whenever such method is called, whatever the number of times the method is called.
Thanks
-Vincent