loose2200 / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

times() verification is not exact when used with a timeout #479

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the JUnit test showThatTimesIsNotExactWithMockitoTimeout() in the 
attached .java file.
2. Recognise that this test passes, when it should have failed.

What is the expected output? What do you see instead?
  I expect a verification with a timeout to only be marked successful if it is successful also at the end of the timeout. Instead, the verification is marked as successful even if it is just successful at some point during the timeout.

What version of the product are you using? On what operating system?
  mockito 1.9.5, on:
  Linux version 3.11.0-18-generic (buildd@toyol) (gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) ) #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014

Please provide any additional information below.
  See the attached .java file for details.

Original issue reported on code.google.com by and...@knowit.no on 26 Mar 2014 at 3:07

Attachments:

GoogleCodeExporter commented 8 years ago
It might be argued that this is intentional behaviour of timeout combined with 
times, but to that I would reply that if I wanted a check which passed as soon 
as the specified number of invocations was reached, I would use the 
atLeast(int) VerificationMode.

Following the same logic that led me to raise this issue, I don't think the 
atMost VerificationMode should be deprecated for timeouts.

Original comment by and...@knowit.no on 27 Mar 2014 at 9:55

GoogleCodeExporter commented 8 years ago
There's been some fixes regarding the timeout implementation. And an new 
'after' method appeared to cover cases where timeout didn't fir well. Could you 
try with the latest code ?

Thanks in advance.

Original comment by brice.du...@gmail.com on 21 Apr 2014 at 6:30