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

Comparing jsr166/src/test/tck/TimeUnitTest.java (file contents):
Revision 1.33 by jsr166, Sun Aug 11 22:29:27 2019 UTC vs.
Revision 1.34 by jsr166, Wed Sep 4 22:18:03 2019 UTC

# Line 581 | Line 581 | public class TimeUnitTest extends JSR166
581      }
582  
583      /**
584 <     * timedSleep throws InterruptedException when interrupted
584 >     * timeUnit.sleep throws InterruptedException when interrupted
585       */
586      public void testTimedSleep_Interruptible() {
587          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
# Line 613 | Line 613 | public class TimeUnitTest extends JSR166
613      }
614  
615      /**
616 +     * timeUnit.sleep(x) for x <= 0 does not sleep at all.
617 +     */
618 +    public void testTimedSleep_nonPositive() throws InterruptedException {
619 +        long startTime = System.nanoTime();
620 +        boolean interrupt = randomBoolean();
621 +        if (interrupt) Thread.currentThread().interrupt();
622 +        randomTimeUnit().sleep(0L);
623 +        randomTimeUnit().sleep(-1L);
624 +        randomTimeUnit().sleep(Long.MIN_VALUE);
625 +        if (interrupt) assertTrue(Thread.interrupted());
626 +    }
627 +
628 +    /**
629       * a deserialized/reserialized unit is the same instance
630       */
631      public void testSerialization() throws Exception {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines