add a testcase for DynamicHasher.NoValuesIterator.nextInt()

This commit is contained in:
dota17 2020-03-19 11:33:44 +08:00
parent a7973b8d30
commit 514c2eddfc
1 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.NoSuchElementException;
import java.util.PrimitiveIterator.OfInt; import java.util.PrimitiveIterator.OfInt;
import org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic; import org.apache.commons.collections4.bloomfilter.hasher.function.MD5Cyclic;
@ -63,6 +64,12 @@ public class DynamicHasherBuilderTest {
final OfInt iter = hasher.iterator(shape); final OfInt iter = hasher.iterator(shape);
assertFalse(iter.hasNext()); assertFalse(iter.hasNext());
try {
iter.nextInt();
fail("Should have thrown NoSuchElementException");
} catch (final NoSuchElementException ignore) {
// do nothing
}
} }
/** /**