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.7 by jsr166, Mon Sep 23 17:23:50 2013 UTC vs.
Revision 1.8 by jsr166, Tue Sep 24 06:17:12 2013 UTC

# Line 284 | Line 284 | public class SplittableRandomTest extend
284       */
285      public void testBadStreamSize() {
286          SplittableRandom r = new SplittableRandom();
287 <        try {
288 <            java.util.stream.IntStream x = r.ints(-1L);
289 <            shouldThrow();
290 <        } catch (IllegalArgumentException success) {}
291 <        try {
292 <            java.util.stream.IntStream x = r.ints(-1L, 2, 3);
293 <            shouldThrow();
294 <        } catch (IllegalArgumentException success) {}
295 <        try {
296 <            java.util.stream.LongStream x = r.longs(-1L);
297 <            shouldThrow();
298 <        } catch (IllegalArgumentException success) {}
299 <        try {
300 <            java.util.stream.LongStream x = r.longs(-1L, -1L, 1L);
301 <            shouldThrow();
302 <        } catch (IllegalArgumentException success) {}
303 <        try {
304 <            java.util.stream.DoubleStream x = r.doubles(-1L);
305 <            shouldThrow();
306 <        } catch (IllegalArgumentException success) {}
307 <        try {
308 <            java.util.stream.DoubleStream x = r.doubles(-1L, .5, .6);
309 <            shouldThrow();
310 <        } catch (IllegalArgumentException success) {}
287 >        Runnable[] throwingActions = {
288 >            () -> { java.util.stream.IntStream x = r.ints(-1L); },
289 >            () -> { java.util.stream.IntStream x = r.ints(-1L, 2, 3); },
290 >            () -> { java.util.stream.LongStream x = r.longs(-1L); },
291 >            () -> { java.util.stream.LongStream x = r.longs(-1L, -1L, 1L); },
292 >            () -> { java.util.stream.DoubleStream x = r.doubles(-1L); },
293 >            () -> { java.util.stream.DoubleStream x = r.doubles(-1L, .5, .6); },
294 >        };
295 >        assertThrows(IllegalArgumentException.class, throwingActions);
296      }
297  
298      /**
# Line 316 | Line 301 | public class SplittableRandomTest extend
301       */
302      public void testBadStreamBounds() {
303          SplittableRandom r = new SplittableRandom();
304 <        try {
305 <            java.util.stream.IntStream x = r.ints(2, 1);
306 <            shouldThrow();
307 <        } catch (IllegalArgumentException success) {}
308 <        try {
309 <            java.util.stream.IntStream x = r.ints(10, 42, 42);
310 <            shouldThrow();
311 <        } catch (IllegalArgumentException success) {}
312 <        try {
328 <            java.util.stream.LongStream x = r.longs(-1L, -1L);
329 <            shouldThrow();
330 <        } catch (IllegalArgumentException success) {}
331 <        try {
332 <            java.util.stream.LongStream x = r.longs(10, 1L, -2L);
333 <            shouldThrow();
334 <        } catch (IllegalArgumentException success) {}
335 <        try {
336 <            java.util.stream.DoubleStream x = r.doubles(0.0, 0.0);
337 <            shouldThrow();
338 <        } catch (IllegalArgumentException success) {}
339 <        try {
340 <            java.util.stream.DoubleStream x = r.doubles(10, .5, .4);
341 <            shouldThrow();
342 <        } catch (IllegalArgumentException success) {}
304 >        Runnable[] throwingActions = {
305 >            () -> { java.util.stream.IntStream x = r.ints(2, 1); },
306 >            () -> { java.util.stream.IntStream x = r.ints(10, 42, 42); },
307 >            () -> { java.util.stream.LongStream x = r.longs(-1L, -1L); },
308 >            () -> { java.util.stream.LongStream x = r.longs(10, 1L, -2L); },
309 >            () -> { java.util.stream.DoubleStream x = r.doubles(0.0, 0.0); },
310 >            () -> { java.util.stream.DoubleStream x = r.doubles(10, .5, .4); },
311 >        };
312 >        assertThrows(IllegalArgumentException.class, throwingActions);
313      }
314  
315      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines