@Test public void basicUnmappedIteratorTest() { GATKSAMIterator iter = ArtificialSAMUtils.mappedAndUnmappedReadIterator(1, 100, 100, 1000); int count = 0; for (int x = 0; x < (100* 100); x++ ) { if (!iter.hasNext()) { fail ("we didn't get the expected number of reads"); } SAMRecord rec = iter.next(); assertTrue(rec.getReferenceIndex() >= 0); count++; } assertEquals(100 * 100, count); // now we should have 1000 unmapped reads count = 0; while (iter.hasNext()) { SAMRecord rec = iter.next(); assertTrue(rec.getReferenceIndex() < 0); count++; } assertEquals(count, 1000); }