jdk/test/java/util/BitSet/BitSetStreamTest.java
changeset 29816 43ad6bf3975b
parent 18167 fb6a6363109c
child 42157 3e87fa9d8226
--- a/jdk/test/java/util/BitSet/BitSetStreamTest.java	Mon Apr 06 13:41:10 2015 -0700
+++ b/jdk/test/java/util/BitSet/BitSetStreamTest.java	Tue Apr 07 10:33:08 2015 +0100
@@ -43,7 +43,7 @@
 /**
  * @test
  * @summary test BitSet stream
- * @bug 8012645
+ * @bug 8012645 8076442
  * @run testng BitSetStreamTest
  */
 public class BitSetStreamTest {
@@ -70,6 +70,7 @@
         { "step 5", IntStream.range(0, 255).map(f -> f * 5) },
         { "step 7", IntStream.range(0, 255).map(f -> f * 7) },
         { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000) },
+        { "max int", IntStream.of(Integer.MAX_VALUE) },
         { "25 fibs", IntStream.generate(new Fibs()).limit(25) }
     };
 
@@ -106,6 +107,8 @@
         for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
             assertTrue(it.hasNext());
             assertEquals(it.nextInt(), i);
+            if (i == Integer.MAX_VALUE)
+                break; // or (i+1) would overflow
         }
         assertFalse(it.hasNext());
     }