easyforgood / mockito

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

timeout with never #347

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It doesn't have any sense to use timeout with atMost. Considering that never is 
equivalent to atMost(0), I think it doesn't make sense either to allow 
combinations of timeout and never either.

Original issue reported on code.google.com by botismar...@gmail.com on 1 Jun 2012 at 3:24

GoogleCodeExporter commented 8 years ago
Good point. Next time we make some changes in the area we might look at it and 
see what can be done to improve it. I'd say it's not a high priority item.

Original comment by szcze...@gmail.com on 1 Jun 2012 at 7:42

GoogleCodeExporter commented 8 years ago
It would be nice to have the following functionality:
verify(a.b(), timeout(x).never()): verify that b is not called within x ms.
verify(a.b(), timeout(x).atMost(y)): verify that b is not called more than y 
times within x ms.

I agree timeout might be incorrect term here, as we are not waiting for the 
condition to become true. Instead we are waiting to see that it stays true. 
Unfortunately I cannot come up with any good term for that.

Original comment by syva...@yahoo.com on 24 Aug 2012 at 1:05

GoogleCodeExporter commented 8 years ago
Hi

The meaning of what you try to achieve is interesting, what about 
'during(x).atMost(y)' ?

Original comment by brice.du...@gmail.com on 24 Aug 2012 at 4:43

GoogleCodeExporter commented 8 years ago
I think I'm ok with adding something like during(). I assume It would always 
wait until the end of the timeout, whereas timeout() has a chance to bail out 
early.

Thanks for the suggestion!

Original comment by szcze...@gmail.com on 25 Aug 2012 at 12:36

GoogleCodeExporter commented 8 years ago
Excellent idea Brice, 'during' sounds very clear!

Original comment by syva...@yahoo.com on 27 Aug 2012 at 7:36

GoogleCodeExporter commented 8 years ago
I've now put up patches to fix this: there's a pull request deprecating 
timeout().never() at https://github.com/mockito/mockito/pull/14, and another 
pull request adding an after() method that provides the functionality you'd 
expect from timeout() here at https://github.com/mockito/mockito/pull/16

Original comment by PimTe...@gmail.com on 31 Jul 2013 at 3:32

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 29 Sep 2014 at 1:02