Verify times not working correctly after consecutive thenThrow stubs
GoogleCodeExporter opened this issue · 0 comments
GoogleCodeExporter commented
using Mockito 1.9.5 on RHEL 5 (64 bit), mockClass is not a Final class
when(mockClass.doSomething(anyString())
.thenThrow(new RuntimeException())
.thenThrow(new RuntimeException())
.thenThrow(new RuntimeException());
verify(mockClass, times(400)).doSomething(anyString());
the verify statement is incorrectly passing. The call to doSomething() is made
only 3 times and I verified this with debugger.
On the other hand
when(mockClass.doSomething(anyString())
.thenThrow(new RuntimeException())
.thenThrow(new RuntimeException())
.thenReturn("someValue");
verify(mockClass, times(400)).doSomething(anyString());
correctly fails reporting that the call was made just 3 times but expected was
400.
Original issue reported on code.google.com by usmani.k...@gmail.com
on 31 Dec 2013 at 4:35