mockito/mockito — pull request #46 by looperhacks (2014-03-31 08:43:45+00:00)
Title: Fix JUnit-specific bugs for timeout-tests

This fixes a problem with VerificationOverTimeImpl in combination with JUnit. Here is an example:

//given
List mock = Mockito.mock(List.class);
Thread t1 = new Thread() {
@Override
public void run() {
mock.add("0");
mock.add("1");
try {
Thread.sleep(100);
} catch (InterruptedException ignored) { }
mock.add("2");
}
};
//when
t1.start();
//then
verify(mock, timeout(200)).add("1");
verify(mock, timeout(200)).add("2");

With JUnit, this fails because add("0") is called before add("1").

The reason for that is that if JUnit is detected, the [JUnitTool creates an](https://github.com/mockito/mockito/blob/master/src/org/mockito/internal/junit/JUnitTool.java#L28) `org.mockito.exceptions.verification.junit.ArgumentsAreDifferent` exception which is not handled in `VerificationOverTimeImpl`. This causes the exception to be thrown before the verification times out.

This pull-request adds handling for the junit.ArgumentsAreDifferent-exception.