ssacher-tgm / mockito

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

Async VerificationMode #205

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have some code that executes a call on a new thread that I would like to test 
using Mockito.  As the junit thread (main) may run verifications before the 
mocked methd is called on another thread we either need to put a sleep in or 
some count down latch.

Ideally I would be able to do 

verify(client, new AsyncVerificationMode(5000l)).onMarketData(marketData);

I tried implementing this, but it looks like there is some concurrency issue in 
Mockito.  

Original issue reported on code.google.com by yuri.sch...@gmail.com on 25 Jul 2010 at 11:29

GoogleCodeExporter commented 8 years ago
That last sentence should probably read, it looks like I haven't fully 
understood how Mockito works with concurrency :)

Original comment by yuri.sch...@gmail.com on 25 Jul 2010 at 11:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Have you seen verify(mock, timeout(1000)).foo(); feature?

Original comment by szcze...@gmail.com on 25 Jul 2010 at 8:06

GoogleCodeExporter commented 8 years ago
Thanks, exactly what I wanted.  I have upgraded from 1.8.2 to 1.8.5.

Original comment by yuri.sch...@gmail.com on 26 Jul 2010 at 7:47

GoogleCodeExporter commented 8 years ago
no probs

Original comment by szcze...@gmail.com on 26 Jul 2010 at 9:05

GoogleCodeExporter commented 8 years ago
Timeouts are 100% evil. Is there no support for fitting a latch in somewhere?

Original comment by primefar...@gmail.com on 14 Jul 2011 at 1:10

GoogleCodeExporter commented 8 years ago
what do you have in mind? Go ahead and propose something ;)

Original comment by szcze...@gmail.com on 15 Jul 2011 at 11:53