MCPcopy Create free account
hub / github.com/ReadyTalk/avian / getTimeoutFail

Method getTimeoutFail

test/FutureTaskTest.java:68–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66 }
67
68 private static void getTimeoutFail() throws InterruptedException,
69 ExecutionException {
70 RunnableFuture<?> future = new FutureTask<Object>(new Runnable() {
71 @Override
72 public void run() {
73 // wont run
74 }
75 }, null);
76
77 long startTime = System.currentTimeMillis();
78 try {
79 future.get(DELAY_TIME, TimeUnit.MILLISECONDS);
80 throw new RuntimeException("Exception should have been thrown");
81 } catch (TimeoutException e) {
82 long catchTime = System.currentTimeMillis();
83 if (catchTime - startTime < DELAY_TIME) {
84 throw new RuntimeException("get with timeout did not block long enough");
85 }
86 }
87 }
88
89 private static void getExecutionExceptionTest() throws InterruptedException, ExecutionException {
90 FutureTask<Object> future = new FutureTask<Object>(new Runnable() {

Callers 1

mainMethod · 0.95

Calls 2

currentTimeMillisMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected