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.52 by jsr166, Sun Jul 22 21:04:56 2018 UTC vs.
Revision 1.56 by jsr166, Thu Sep 5 21:46:35 2019 UTC

# Line 464 | Line 464 | public class FutureTaskTest extends JSR1
464          try {
465              task.cancel(true);
466              shouldThrow();
467 <        } catch (SecurityException expected) {}
467 >        } catch (SecurityException success) {}
468  
469          // We failed to deliver the interrupt, but the world retains
470          // its sanity, as if we had done task.cancel(false)
# Line 720 | Line 720 | public class FutureTaskTest extends JSR1
720      /**
721       * get is interruptible
722       */
723 <    public void testGet_interruptible() {
723 >    public void testGet_Interruptible() {
724          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
725          final FutureTask task = new FutureTask(new NoOpCallable());
726          Thread t = newStartedThread(new CheckedRunnable() {
# Line 749 | Line 749 | public class FutureTaskTest extends JSR1
749      /**
750       * timed get is interruptible
751       */
752 <    public void testTimedGet_interruptible() {
752 >    public void testTimedGet_Interruptible() {
753          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
754          final FutureTask task = new FutureTask(new NoOpCallable());
755          Thread t = newStartedThread(new CheckedRunnable() {
756              public void realRun() throws Exception {
757                  Thread.currentThread().interrupt();
758                  try {
759 <                    task.get(2*LONG_DELAY_MS, MILLISECONDS);
759 >                    task.get(randomTimeout(), randomTimeUnit());
760                      shouldThrow();
761                  } catch (InterruptedException success) {}
762                  assertFalse(Thread.interrupted());
763  
764                  pleaseInterrupt.countDown();
765                  try {
766 <                    task.get(2*LONG_DELAY_MS, MILLISECONDS);
766 >                    task.get(LONGER_DELAY_MS, MILLISECONDS);
767                      shouldThrow();
768                  } catch (InterruptedException success) {}
769                  assertFalse(Thread.interrupted());
770              }});
771  
772          await(pleaseInterrupt);
773 +        if (randomBoolean()) assertThreadBlocks(t, Thread.State.TIMED_WAITING);
774          t.interrupt();
775          awaitTermination(t);
776          checkNotDone(task);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines