36 |
public void testConstructor() { |
public void testConstructor() { |
37 |
try { |
try { |
38 |
FutureTask task = new FutureTask(null); |
FutureTask task = new FutureTask(null); |
39 |
shouldThrow("NullPointerException"); |
shouldThrow(); |
40 |
} catch (NullPointerException success) {} |
} catch (NullPointerException success) {} |
41 |
} |
} |
42 |
|
|
46 |
public void testConstructor2() { |
public void testConstructor2() { |
47 |
try { |
try { |
48 |
FutureTask task = new FutureTask(null, Boolean.TRUE); |
FutureTask task = new FutureTask(null, Boolean.TRUE); |
49 |
shouldThrow("NullPointerException"); |
shouldThrow(); |
50 |
} catch (NullPointerException success) {} |
} catch (NullPointerException success) {} |
51 |
} |
} |
52 |
|
|
100 |
task.setException(nse); |
task.setException(nse); |
101 |
try { |
try { |
102 |
Object x = task.get(); |
Object x = task.get(); |
103 |
shouldThrow("ExecutionException"); |
shouldThrow(); |
104 |
} catch (ExecutionException success) { |
} catch (ExecutionException success) { |
105 |
assertSame(success.getCause(), nse); |
assertSame(success.getCause(), nse); |
106 |
} |
} |
289 |
ft.run(); |
ft.run(); |
290 |
try { |
try { |
291 |
ft.get(); |
ft.get(); |
292 |
shouldThrow("ExecutionException"); |
shouldThrow(); |
293 |
} catch (ExecutionException success) { |
} catch (ExecutionException success) { |
294 |
assertTrue(success.getCause() instanceof ArithmeticException); |
assertTrue(success.getCause() instanceof ArithmeticException); |
295 |
} |
} |
307 |
ft.run(); |
ft.run(); |
308 |
try { |
try { |
309 |
ft.get(SHORT_DELAY_MS, MILLISECONDS); |
ft.get(SHORT_DELAY_MS, MILLISECONDS); |
310 |
shouldThrow("ExecutionException"); |
shouldThrow(); |
311 |
} catch (ExecutionException success) { |
} catch (ExecutionException success) { |
312 |
assertTrue(success.getCause() instanceof ArithmeticException); |
assertTrue(success.getCause() instanceof ArithmeticException); |
313 |
} |
} |
353 |
try { |
try { |
354 |
FutureTask ft = new FutureTask(new NoOpCallable()); |
FutureTask ft = new FutureTask(new NoOpCallable()); |
355 |
ft.get(1,MILLISECONDS); |
ft.get(1,MILLISECONDS); |
356 |
shouldThrow("TimeoutException"); |
shouldThrow(); |
357 |
} catch (TimeoutException success) {} |
} catch (TimeoutException success) {} |
358 |
} |
} |
359 |
|
|