ObjectSet<String> chromosomeSeen = new ObjectArraySet<String>();
// maximum number of entries to inspect (keep low for faster test).
int maxEntries = 100000;
int countVisit = 0;
while (iter.hasNext()) {
Alignment a = iter.next();
final String entryChr = a.getChr();
// System.out.println("chr:" + entryChr);
if (entryChr.equals(previousChr)) {
assertTrue(a.getAlignmentStart() >= previousAlignmentStart);
} else {
assertFalse("Chromosomes should occur in blocks." +
" A chromosome that was used in a previous block of entry cannot occur again.",
chromosomeSeen.contains(a.getChr()));
previousChr = a.getChr();
chromosomeSeen.add(a.getChr());
}
countVisit++;
if (countVisit > maxEntries) break;
}