Skip to content

Instantly share code, notes, and snippets.

@vorburger
Created December 19, 2017 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vorburger/775082c8b24b22cf0b69cba66744db12 to your computer and use it in GitHub Desktop.
Save vorburger/775082c8b24b22cf0b69cba66744db12 to your computer and use it in GitHub Desktop.
@Test
public void testBasicWait() throws InterruptedException, ExecutionException {
long millis = 500;
final AtomicReference<Future<?>> futureRef = new AtomicReference<>();
testAndVerifyTimeBounds(executorService ->
futureRef.set(executorService.submit(() -> {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
// Ignored
}
})), millis, 1000);
futureRef.get().get();
}
@vorburger
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment