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

Comparing jsr166/src/test/tck/SplittableRandomTest.java (file contents):
Revision 1.22 by jsr166, Tue Oct 3 22:27:04 2017 UTC vs.
Revision 1.24 by jsr166, Fri Oct 13 16:14:40 2017 UTC

# Line 5 | Line 5
5   */
6  
7   import java.util.Arrays;
8 import java.util.ArrayList;
8   import java.util.List;
9   import java.util.SplittableRandom;
10   import java.util.concurrent.atomic.AtomicInteger;
# Line 562 | Line 561 | public class SplittableRandomTest extend
561       */
562      public void testNextBytes() {
563          SplittableRandom sr = new SplittableRandom();
564 <        int n = sr.nextInt(20);
564 >        int n = sr.nextInt(1, 20);
565          byte[] bytes = new byte[n];
566          outer:
567          for (int i = 0; i < n; i++) {
# Line 577 | Line 576 | public class SplittableRandomTest extend
576          }
577      }
578  
579 +    /**
580 +     * Filling an empty array with random bytes succeeds without effect.
581 +     */
582 +    public void testNextBytes_emptyArray() {
583 +        new SplittableRandom().nextBytes(new byte[0]);
584 +    }
585 +
586 +    public void testNextBytes_nullArray() {
587 +        try {
588 +            new SplittableRandom().nextBytes(null);
589 +            shouldThrow();
590 +        } catch (NullPointerException success) {}
591 +    }
592 +
593   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines