Open tarnowskijan opened 8 years ago
Issue #345 resolves this for atMost verification. What about other verification modes (i.e. times, atLeast)? Are you working on that, @tarnowskijan? Was the issue only for the atMost case? Because in the code from the description you used times instead of atMost.
@thesnowgoose, unfortunately you're right, the issue is still there when you use times() in combination with after(). I only fixed the problem with after() and atMost() and I don't know why I was focused only on this case. I'll try to fix the whole issue in the near future, but feel free to propose your own solution if you already have one.
Actually I'm working on it. There is also an issue when you use atLeast(), I'll try to fix it too. Regards!!. @tarnowskijan
Personally, I use extensively timeout and after in my tests, because their use is significantly different. Replace those by a single await can seem interesting at a first glance, but it is actually not.
@jmborer Could you elaborate ?
Well I have to test in a lot of asynch situations. Sometimes I need to wait for a interaction, continue quickly if it occurs before a given amount of time and fail otherwise. There I use timeout(). Then I have situations where I want to wait a given time and THEN only do the check. This is where I use after() instead of Thread.sleep()+verify() which I find less fluent to read...
@jmborer Thanks for the feedback I linked your comment in #472
will be fixed with #936 aka within(duration,timeunit)
Will this be fixed? Mockito 2.19.0 still has this problem and the mentioned pull request which could resolve this (https://github.com/mockito/mockito/pull/936) was put on hold. Please either fix this or provide a way to express the after(x).atLeast(y) without having the argument captor returning a collection with millions [sic] of items via ArgumentCaptor#getAllValues()
although the method was called only a couple of times.
@Trinova #936 needs to be reviewed by a core member, there is nothing I can do as contributor. I don't know if it will ever happen since the core-team is busy and doesn't plan to hire new core member. Maybe the community should fork Mockito and release it with an other group and artefact-id to overcome the prolonged review process.
Hi, I found weird behavior of Mockito (ver. 1.10.19) when verifying method invocation with after() and ArgumentCaptor. The list of captured values returned by ArgumentCaptor has size much bigger than I expect. Moreover this behavior in connection with long timeout leads to exceeding memory limit. Example below. Is it expected behavior or bug?