BitSet implements Serializable, Cloneable { void set(int index) { bits[index >>> 6] |= 1L << (index & 0x3F); } BitSet(int numBits); private  BitSet(long[] bits); @Override BitSet clone(); @Override String toString();  }
@Test public void testBounds() { BitSet bitSet = new BitSet(NUM_BITS); try { bitSet.set(1000); fail("Should have thrown exception"); } catch (ArrayIndexOutOfBoundsException aioobe) { } try { bitSet.set(-1); fail("Should have thrown exception"); } catch (ArrayIndexOutOfBoundsException aioobe) { } }
@Test(expected = ArrayIndexOutOfBoundsException.class) public void testBounds1() { BitSet bitSet = new BitSet(NUM_BITS); bitSet.set(1000); }
@Test(expected = ArrayIndexOutOfBoundsException.class) public void testBounds2() { BitSet bitSet = new BitSet(NUM_BITS); bitSet.set(-1); }