mockito/mockito — pull request #16 by pimterry (2013-07-31 15:27:26+00:00)
Title: Adds an after() method, which acts like timeout() but does not immediately return if the test passes

As discussed in https://code.google.com/p/mockito/issues/detail?id=347 and https://code.google.com/p/mockito/issues/detail?id=235.

Note that this builds on my other two recent pull requests (#14/#15), which should probably be merged first. I've separated them out, since this is obviously more contentious, and the other two are valid and useful on their own.

This allows for the following:

```java
verify(mock, after(100).never()).method()
```

which will return either successfully after 100ms, or fail as soon as `mock.method()` is invoked.

This contrasts with the current behaviour for `verify(mock, timeout(100).never())`, which will either return instantly successfully if mock.method() has not yet been called, or fail after 100ms if it had already been called before this assertion was run.

This fix both adds the above after() method, and also tweaks timeout so that it will now terminate successfully when a success is seen (as before), fail if the timeout runs out (as before), or fail early if the underlying verification is known to have definitely failed before the time runs out (as in this new after() implementation).