@Test public void awaitTimeConstraints_withTimeout_Fails() throws InterruptedException { WaitingObserver observer = new WaitingObserver(); TimeConstraints tc = mock(TimeConstraints.class); when(tc.getTimeRemaining()).thenReturn(100L); notifyAfter(observer, 1000); assertFalse(observer.await(tc)); }
public boolean await(long timeoutInMillis) throws InterruptedException { if (timeoutInMillis > 0) { return latch.await(timeoutInMillis, TimeUnit.MILLISECONDS); } else { latch.await(); return true; } }
WaitingObserver implements ExecutionObserver { public boolean await(long timeoutInMillis) throws InterruptedException { if (timeoutInMillis > 0) { return latch.await(timeoutInMillis, TimeUnit.MILLISECONDS); } else { latch.await(); return true; } } }
WaitingObserver implements ExecutionObserver { public boolean await(long timeoutInMillis) throws InterruptedException { if (timeoutInMillis > 0) { return latch.await(timeoutInMillis, TimeUnit.MILLISECONDS); } else { latch.await(); return true; } }  }
WaitingObserver implements ExecutionObserver { public boolean await(long timeoutInMillis) throws InterruptedException { if (timeoutInMillis > 0) { return latch.await(timeoutInMillis, TimeUnit.MILLISECONDS); } else { latch.await(); return true; } }  @Override void onResult(ExecutionResult executionResult); ExecutionResult getExecutionResult(); boolean await(long timeoutInMillis); boolean await(TimeConstraints timeConstraints); }
WaitingObserver implements ExecutionObserver { public boolean await(long timeoutInMillis) throws InterruptedException { if (timeoutInMillis > 0) { return latch.await(timeoutInMillis, TimeUnit.MILLISECONDS); } else { latch.await(); return true; } }  @Override void onResult(ExecutionResult executionResult); ExecutionResult getExecutionResult(); boolean await(long timeoutInMillis); boolean await(TimeConstraints timeConstraints);  }