ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/FutureTaskTest.java
(Generate patch)

Comparing jsr166/src/test/tck/FutureTaskTest.java (file contents):
Revision 1.1 by dl, Sun Aug 31 19:24:55 2003 UTC vs.
Revision 1.3 by dl, Fri Sep 12 15:40:25 2003 UTC

# Line 21 | Line 21 | public class FutureTaskTest extends Test
21      private static long MEDIUM_DELAY_MS = 1000;
22      private static long LONG_DELAY_MS = 10000;
23  
24 +    public void testConstructor(){
25 +        try {
26 +            FutureTask task = new FutureTask(null);
27 +            fail("should throw");
28 +        }
29 +        catch(NullPointerException success) {
30 +        }
31 +    }
32 +
33 +    public void testConstructor2(){
34 +        try {
35 +            FutureTask task = new FutureTask(null, Boolean.TRUE);
36 +            fail("should throw");
37 +        }
38 +        catch(NullPointerException success) {
39 +        }
40 +    }
41 +
42      public void testIsDone(){
43          FutureTask task = new FutureTask( new Callable() {
44                  public Object call() { return Boolean.TRUE; } });
# Line 111 | Line 129 | public class FutureTaskTest extends Test
129                  public Object call(){
130                      try{
131                          Thread.sleep(MEDIUM_DELAY_MS);
132 <                    }catch(InterruptedException e){
132 >                    } catch(InterruptedException e){
133                          fail("unexpected exception");
134                      }
135                      return Boolean.TRUE;
# Line 121 | Line 139 | public class FutureTaskTest extends Test
139                  public void run(){
140                      try{
141                          ft.get();
142 <                    }catch(Exception e){
142 >                    } catch(Exception e){
143                          fail("unexpected exception");
144                      }
145                  }
# Line 146 | Line 164 | public class FutureTaskTest extends Test
164                  public Object call(){
165                      try{
166                          Thread.sleep(MEDIUM_DELAY_MS);
167 <                    }catch(InterruptedException e){
167 >                    } catch(InterruptedException e){
168                          fail("unexpected exception");
169                      }
170                      return Boolean.TRUE;
# Line 182 | Line 200 | public class FutureTaskTest extends Test
200                  public Object call(){
201                      try{
202                          Thread.sleep(MEDIUM_DELAY_MS);
203 <                    }catch(InterruptedException e){
203 >                    } catch(InterruptedException e){
204                          fail("unexpected exception");
205                      }
206                      return Boolean.TRUE;
# Line 195 | Line 213 | public class FutureTaskTest extends Test
213                          try{
214                              ft.get();
215                              fail("should throw");
216 <                        }catch(CancellationException success){
216 >                        } catch(CancellationException success){
217                          }
218                          catch(Exception e){
219                              fail("unexpected exception");
# Line 205 | Line 223 | public class FutureTaskTest extends Test
223              t.start();
224              ft.cancel(true);
225              t.join();
226 <        }catch(InterruptedException sucess){
226 >        } catch(InterruptedException success){
227              fail("unexpected exception");
228          }
229      }
# Line 228 | Line 246 | public class FutureTaskTest extends Test
246                          try{
247                              ft.get(3 * SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
248                              fail("should throw");
249 <                        }catch(CancellationException success) {}
249 >                        } catch(CancellationException success) {}
250                          catch(Exception e){
251                              fail("unexpected exception");
252                          }
# Line 239 | Line 257 | public class FutureTaskTest extends Test
257              ft.cancel(true);
258              Thread.sleep(SHORT_DELAY_MS);
259              t.join();
260 <        }catch(InterruptedException ie){
260 >        } catch(InterruptedException ie){
261              fail("unexpected exception");
262          }
263      }
# Line 255 | Line 273 | public class FutureTaskTest extends Test
273              ft.run();
274              ft.get();
275              fail("should throw");
276 <        }catch(ExecutionException success){
276 >        } catch(ExecutionException success){
277          }
278          catch(Exception e){
279              fail("unexpected exception");
# Line 273 | Line 291 | public class FutureTaskTest extends Test
291              ft.run();
292              ft.get(SHORT_DELAY_MS, TimeUnit.MILLISECONDS);
293              fail("should throw");
294 <        }catch(ExecutionException success) {
295 <        }catch(TimeoutException success) { } // unlikely but OK
294 >        } catch(ExecutionException success) {
295 >        } catch(TimeoutException success) { } // unlikely but OK
296          catch(Exception e){
297              fail("unexpected exception");
298          }
# Line 319 | Line 337 | public class FutureTaskTest extends Test
337                      try{
338                          ft.get(100,TimeUnit.SECONDS);
339                          fail("should throw");
340 <                    }catch(InterruptedException success){}
340 >                    } catch(InterruptedException success){}
341                      catch(Exception e){
342                          fail("unexpected exception");
343                      }
# Line 344 | Line 362 | public class FutureTaskTest extends Test
362          try{
363              ft.get(1,TimeUnit.MILLISECONDS);
364              fail("should throw");
365 <        }catch(TimeoutException success){}
366 <        catch(Exception sucess){
365 >        } catch(TimeoutException success){}
366 >        catch(Exception success){
367              fail("unexpected exception");
368          }
369          

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines