@Override
public boolean hasNext()
{
- return current + 1 <= last;
+ return next <= last;
}
@Override
public Integer next()
{
- if (current + 1 > last)
+ if (next > last)
{
throw new NoSuchElementException();
}
@Override
public boolean hasNext()
{
- return current + 1 <= last;
+ return next <= last;
}
@Override
public Integer next()
{
- if (current + 1 > last)
+ if (next > last)
{
throw new NoSuchElementException();
}
AllColsIterator it = new AllColsIterator(0, 3, hiddenCols);
it.remove();
}
+
+ /*
+ * Test iterator behaves correctly when there is only one element in the collection
+ */
+ @Test(groups = { "Functional" })
+ public void testOneElement()
+ {
+ HiddenColumns hidden = new HiddenColumns();
+ AllColsIterator it = new AllColsIterator(0, 0, hidden);
+ int count = 0;
+ while (it.hasNext())
+ {
+ it.next();
+ count++;
+ }
+ assertTrue(count == 1, "hasNext() is false after 1 iteration");
+ }
}
{
AlignmentI al;
- Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<SequenceI, SequenceCollectionI>();
+ Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<>();
@BeforeClass
public void setup()
hiddenRepSequences.put(allseqs[start], theseSeqs);
}
+
+ /*
+ * Test iterator behaves correctly when there is only one element in the collection
+ */
+ @Test(groups = { "Functional" })
+ public void testOneElement()
+ {
+ AllRowsIterator it = new AllRowsIterator(0, 0, al);
+ int count = 0;
+ while (it.hasNext())
+ {
+ it.next();
+ count++;
+ }
+ assertTrue(count == 1, "hasNext() is false after 1 iteration");
+ }
+
}