BitVectorIterator implements Iterator<Boolean> { @Override public Boolean next() { if (this.pointer >= this.bitVector.size()) { throw new NoSuchElementException(); } return this.bitVector.getBit(this.pointer++); } BitVectorIterator(BitVector bitVector); @Override boolean equals(Object o); @Override int hashCode(); @Override boolean hasNext(); @Override Boolean next(); @Override void remove();  }
@Test(expected = NoSuchElementException.class) public void testNoSuchElementException() { new BitVectorImpl().iterator().next(); }