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

Comparing jsr166/src/test/tck/ThreadLocalRandom8Test.java (file contents):
Revision 1.5 by jsr166, Tue Sep 24 16:39:38 2013 UTC vs.
Revision 1.6 by jsr166, Fri Sep 27 20:28:04 2013 UTC

# Line 34 | Line 34 | public class ThreadLocalRandom8Test exte
34       */
35      public void testBadStreamSize() {
36          ThreadLocalRandom r = ThreadLocalRandom.current();
37 <        try {
38 <            java.util.stream.IntStream x = r.ints(-1L);
39 <            shouldThrow();
40 <        } catch (IllegalArgumentException success) {}
41 <        try {
42 <            java.util.stream.IntStream x = r.ints(-1L, 2, 3);
43 <            shouldThrow();
44 <        } catch (IllegalArgumentException success) {}
45 <        try {
46 <            java.util.stream.LongStream x = r.longs(-1L);
47 <            shouldThrow();
48 <        } catch (IllegalArgumentException success) {}
49 <        try {
50 <            java.util.stream.LongStream x = r.longs(-1L, -1L, 1L);
51 <            shouldThrow();
52 <        } catch (IllegalArgumentException success) {}
53 <        try {
54 <            java.util.stream.DoubleStream x = r.doubles(-1L);
55 <            shouldThrow();
56 <        } catch (IllegalArgumentException success) {}
57 <        try {
58 <            java.util.stream.DoubleStream x = r.doubles(-1L, .5, .6);
59 <            shouldThrow();
60 <        } catch (IllegalArgumentException success) {}
37 >        Runnable[] throwingActions = {
38 >            () -> r.ints(-1L),
39 >            () -> r.ints(-1L, 2, 3),
40 >            () -> r.longs(-1L),
41 >            () -> r.longs(-1L, -1L, 1L),
42 >            () -> r.doubles(-1L),
43 >            () -> r.doubles(-1L, .5, .6),
44 >        };
45 >        assertThrows(IllegalArgumentException.class, throwingActions);
46      }
47  
48      /**
# Line 66 | Line 51 | public class ThreadLocalRandom8Test exte
51       */
52      public void testBadStreamBounds() {
53          ThreadLocalRandom r = ThreadLocalRandom.current();
54 <        try {
55 <            java.util.stream.IntStream x = r.ints(2, 1);
56 <            shouldThrow();
57 <        } catch (IllegalArgumentException success) {}
58 <        try {
59 <            java.util.stream.IntStream x = r.ints(10, 42, 42);
60 <            shouldThrow();
61 <        } catch (IllegalArgumentException success) {}
62 <        try {
78 <            java.util.stream.LongStream x = r.longs(-1L, -1L);
79 <            shouldThrow();
80 <        } catch (IllegalArgumentException success) {}
81 <        try {
82 <            java.util.stream.LongStream x = r.longs(10, 1L, -2L);
83 <            shouldThrow();
84 <        } catch (IllegalArgumentException success) {}
85 <        try {
86 <            java.util.stream.DoubleStream x = r.doubles(0.0, 0.0);
87 <            shouldThrow();
88 <        } catch (IllegalArgumentException success) {}
89 <        try {
90 <            java.util.stream.DoubleStream x = r.doubles(10, .5, .4);
91 <            shouldThrow();
92 <        } catch (IllegalArgumentException success) {}
54 >        Runnable[] throwingActions = {
55 >            () -> r.ints(2, 1),
56 >            () -> r.ints(10, 42, 42),
57 >            () -> r.longs(-1L, -1L),
58 >            () -> r.longs(10, 1L, -2L),
59 >            () -> r.doubles(0.0, 0.0),
60 >            () -> r.doubles(10, .5, .4),
61 >        };
62 >        assertThrows(IllegalArgumentException.class, throwingActions);
63      }
64  
65      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines