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

Comparing jsr166/src/test/tck/JSR166TestCase.java (file contents):
Revision 1.35 by jsr166, Mon Aug 3 19:07:51 2009 UTC vs.
Revision 1.37 by dl, Tue Aug 4 00:23:18 2009 UTC

# Line 9 | Line 9
9   import junit.framework.*;
10   import java.util.*;
11   import java.util.concurrent.*;
12 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
13   import java.io.*;
14   import java.security.*;
15  
# Line 288 | Line 289 | public class JSR166TestCase extends Test
289       * threadFail with message "should throw exception"
290       */
291      public void threadShouldThrow() {
292 <        try {
293 <            threadFailed = true;
293 <            fail("should throw exception");
294 <        } catch (AssertionFailedError e) {
295 <            e.printStackTrace();
296 <            throw e;
297 <        }
292 >        threadFailed = true;
293 >        fail("should throw exception");
294      }
295  
296      /**
# Line 320 | Line 316 | public class JSR166TestCase extends Test
316      public void joinPool(ExecutorService exec) {
317          try {
318              exec.shutdown();
319 <            assertTrue(exec.awaitTermination(LONG_DELAY_MS, TimeUnit.MILLISECONDS));
319 >            assertTrue(exec.awaitTermination(LONG_DELAY_MS, MILLISECONDS));
320          } catch (SecurityException ok) {
321              // Allowed in case test doesn't have privs
322          } catch (InterruptedException ie) {
# Line 343 | Line 339 | public class JSR166TestCase extends Test
339          fail("Unexpected exception");
340      }
341  
342 +    /**
343 +     * fail with message "Unexpected exception", with argument
344 +     */
345 +    public void unexpectedException(Throwable ex) {
346 +        ex.printStackTrace();
347 +        fail("Unexpected exception: " + ex);
348 +    }
349 +
350  
351      /**
352       * The number of elements to place in collections, arrays, etc.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines