{
AlignmentI al;
- Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<SequenceI, SequenceCollectionI>();
+ Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<>();
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
public void setup()
{
// create random alignment
* Test iterator throws NoSuchElementException at end of iteration
*/
@Test(
- groups = { "Functional" },
- expectedExceptions = { NoSuchElementException.class })
+ groups =
+ { "Functional" },
+ expectedExceptions =
+ { NoSuchElementException.class })
public void testLastNext() throws NoSuchElementException
{
AllRowsIterator it = new AllRowsIterator(0, 3, al);
* Test iterator throws UnsupportedOperationException on call to remove
*/
@Test(
- groups = { "Functional" },
- expectedExceptions = { UnsupportedOperationException.class })
+ groups =
+ { "Functional" },
+ expectedExceptions =
+ { UnsupportedOperationException.class })
public void testRemove() throws UnsupportedOperationException
{
AllRowsIterator it = new AllRowsIterator(0, 3, al);
it.remove();
}
-
/*
* Hide sequences between start and end
*/
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");
+ }
+
}