I'm facing the same problem.
It seems to be a bug in JMock. See the JIRA
http://jira.codehaus.org/browse/JMOCK-129.
ravisankarvivek wrote:
Hi,
I am facing a slightly weird problem. I set an expectation as
*exactly(n).of(<mock-obj>).f()*
*Bug*
Suppose the function f() is called 5 times; For any n < 5, the expectation
fails. However, if I provide the value of n > 5, it passes for all!!
Eg: *exactly(100).of(<mock-obj>).f()*
The above expectation passes, even though the function f() is called only 5
times!
Any thoughts ?
PS: The expectation is under a context and the syntax is perfectly fine. In
short, the java file compiles fine!
-Vivek