--- jsr166/src/test/tck/ExecutorCompletionServiceTest.java 2009/11/21 02:33:20 1.9 +++ jsr166/src/test/tck/ExecutorCompletionServiceTest.java 2009/11/21 06:31:05 1.10 @@ -31,8 +31,7 @@ public class ExecutorCompletionServiceTe try { ExecutorCompletionService ecs = new ExecutorCompletionService(null); shouldThrow(); - } catch (NullPointerException success) { - } + } catch (NullPointerException success) {} } /** @@ -43,8 +42,7 @@ public class ExecutorCompletionServiceTe ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e, null); shouldThrow(); - } catch (NullPointerException success) { - } + } catch (NullPointerException success) {} } /** @@ -82,7 +80,7 @@ public class ExecutorCompletionServiceTe /** * A taken submitted task is completed */ - public void testTake() { + public void testTake() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { @@ -90,8 +88,6 @@ public class ExecutorCompletionServiceTe ecs.submit(c); Future f = ecs.take(); assertTrue(f.isDone()); - } catch (Exception ex) { - unexpectedException(); } finally { joinPool(e); } @@ -100,7 +96,7 @@ public class ExecutorCompletionServiceTe /** * Take returns the same future object returned by submit */ - public void testTake2() { + public void testTake2() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { @@ -108,8 +104,6 @@ public class ExecutorCompletionServiceTe Future f1 = ecs.submit(c); Future f2 = ecs.take(); assertSame(f1, f2); - } catch (Exception ex) { - unexpectedException(); } finally { joinPool(e); } @@ -118,7 +112,7 @@ public class ExecutorCompletionServiceTe /** * If poll returns non-null, the returned task is completed */ - public void testPoll1() { + public void testPoll1() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { @@ -133,8 +127,6 @@ public class ExecutorCompletionServiceTe break; } } - } catch (Exception ex) { - unexpectedException(); } finally { joinPool(e); } @@ -143,7 +135,7 @@ public class ExecutorCompletionServiceTe /** * If timed poll returns non-null, the returned task is completed */ - public void testPoll2() { + public void testPoll2() throws InterruptedException { ExecutorService e = Executors.newCachedThreadPool(); ExecutorCompletionService ecs = new ExecutorCompletionService(e); try { @@ -153,8 +145,6 @@ public class ExecutorCompletionServiceTe Future f = ecs.poll(SHORT_DELAY_MS, MILLISECONDS); if (f != null) assertTrue(f.isDone()); - } catch (Exception ex) { - unexpectedException(); } finally { joinPool(e); } @@ -163,7 +153,7 @@ public class ExecutorCompletionServiceTe * Submitting to underlying AES that overrides newTaskFor(Callable) * returns and eventually runs Future returned by newTaskFor. */ - public void testNewTaskForCallable() { + public void testNewTaskForCallable() throws InterruptedException { final AtomicBoolean done = new AtomicBoolean(false); class MyCallableFuture extends FutureTask { MyCallableFuture(Callable c) { super(c); } @@ -187,8 +177,6 @@ public class ExecutorCompletionServiceTe Future f2 = ecs.take(); assertSame("submit and take must return same objects", f1, f2); assertTrue("completed task must have set done", done.get()); - } catch (Exception ex) { - unexpectedException(); } finally { joinPool(e); } @@ -198,7 +186,7 @@ public class ExecutorCompletionServiceTe * Submitting to underlying AES that overrides newTaskFor(Runnable,T) * returns and eventually runs Future returned by newTaskFor. */ - public void testNewTaskForRunnable() { + public void testNewTaskForRunnable() throws InterruptedException { final AtomicBoolean done = new AtomicBoolean(false); class MyRunnableFuture extends FutureTask { MyRunnableFuture(Runnable t, V r) { super(t, r); } @@ -222,13 +210,9 @@ public class ExecutorCompletionServiceTe Future f2 = ecs.take(); assertSame("submit and take must return same objects", f1, f2); assertTrue("completed task must have set done", done.get()); - } catch (Exception ex) { - unexpectedException(); } finally { joinPool(e); } } - - }