Skip to content

Commit

Permalink
Try to fix race conditions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesagnew committed Sep 26, 2016
1 parent a95341d commit 090f079
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -113,6 +114,10 @@ public void testValidate() throws Exception {
order.verify(myInterceptor2, times(1)).incomingRequestPreHandled(any(RestOperationTypeEnum.class), any(ActionRequestDetails.class));
order.verify(myInterceptor2, times(1)).outgoingResponse(any(RequestDetails.class), any(IResource.class));
order.verify(myInterceptor1, times(1)).outgoingResponse(any(RequestDetails.class), any(IResource.class));

// Avoid concurrency issues
Thread.sleep(500);

order.verify(myInterceptor2, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
order.verify(myInterceptor1, times(1)).processingCompletedNormally(any(ServletRequestDetails.class));
verifyNoMoreInteractions(myInterceptor1);
Expand Down

0 comments on commit 090f079

Please sign in to comment.