[cvs] / jsr166 / src / test / tck / FutureTaskTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/FutureTaskTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16, Sat Nov 21 02:07:26 2009 UTC revision 1.20, Thu Sep 16 00:52:49 2010 UTC
# Line 36  Line 36 
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    
# Line 46  Line 46 
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    
# Line 88  Line 88 
88      public void testSet() throws Exception {      public void testSet() throws Exception {
89          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());          PublicFutureTask task = new PublicFutureTask(new NoOpCallable());
90          task.set(one);          task.set(one);
91          assertEquals(task.get(), one);          assertSame(task.get(), one);
92      }      }
93    
94      /**      /**
# Line 100  Line 100 
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          }          }
# Line 229  Line 229 
229      }      }
230    
231      /**      /**
232       *  Cancelling a task causes timed get in another thread to throw CancellationException       *  Cancelling a task causes timed get in another thread to throw
233         *  CancellationException
234       */       */
235      public void testTimedGet_Cancellation() throws InterruptedException {      public void testTimedGet_Cancellation() throws InterruptedException {
236          final FutureTask ft =          final FutureTask ft =
# Line 253  Line 254 
254      }      }
255    
256      /**      /**
257       * Cancelling a task causes get in another thread to throw CancellationException       * Cancelling a task causes get in another thread to throw
258         * CancellationException
259       */       */
260      public void testGet_Cancellation() throws InterruptedException {      public void testGet_Cancellation() throws InterruptedException {
261          final FutureTask ft =          final FutureTask ft =
# Line 289  Line 291 
291          ft.run();          ft.run();
292          try {          try {
293              ft.get();              ft.get();
294              shouldThrow("ExecutionException");              shouldThrow();
295          } catch (ExecutionException success) {          } catch (ExecutionException success) {
296              assertTrue(success.getCause() instanceof ArithmeticException);              assertTrue(success.getCause() instanceof ArithmeticException);
297          }          }
# Line 307  Line 309 
309          ft.run();          ft.run();
310          try {          try {
311              ft.get(SHORT_DELAY_MS, MILLISECONDS);              ft.get(SHORT_DELAY_MS, MILLISECONDS);
312              shouldThrow("ExecutionException");              shouldThrow();
313          } catch (ExecutionException success) {          } catch (ExecutionException success) {
314              assertTrue(success.getCause() instanceof ArithmeticException);              assertTrue(success.getCause() instanceof ArithmeticException);
315          }          }
# Line 353  Line 355 
355          try {          try {
356              FutureTask ft = new FutureTask(new NoOpCallable());              FutureTask ft = new FutureTask(new NoOpCallable());
357              ft.get(1,MILLISECONDS);              ft.get(1,MILLISECONDS);
358              shouldThrow("TimeoutException");              shouldThrow();
359          } catch (TimeoutException success) {}          } catch (TimeoutException success) {}
360      }      }
361    

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.20

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8