Is this possible?
I tried with EasyMock.expectLastCall().times(0);
but EasyMock complains that times must be >=1
views:
40answers:
3
A:
Looks like a bug to me. The internal class Range
does not allow to set a maximum less than 1.
Couldn't you mock that method, and just call Assert.fail()
?
Christian Strempfer
2010-09-15 06:54:29
yes, I did it that way eventually, see my answer
nkr1pt
2010-09-15 20:54:50
A:
I managed to come up with a solution:
expectLastCall().andAnswer(new IAnswer() {
public Object answer() {
Assert.assertFail();
return null;
}
});
nkr1pt
2010-09-15 20:54:07
A:
If you expect your method not to be called then just don't record it. But I agree it won't work with a nice mock.
Henri Tremblay
2010-09-16 21:54:12