public class AllColsIteratorTest
{
- ColumnSelection hiddenCols;
-
- @BeforeClass
+ HiddenColumns hiddenCols;
+
+ @BeforeClass(alwaysRun = true)
public void setup()
{
- hiddenCols = new ColumnSelection();
- hiddenCols.hideColumns(2,4);
+ hiddenCols = new HiddenColumns();
+ hiddenCols.hideColumns(2, 4);
}
-
/*
* Test iterator iterates through collection correctly
* Test iterator throws NoSuchElementException at end of iteration
*/
@Test(
- groups = { "Functional" },
- expectedExceptions = { NoSuchElementException.class })
+ groups =
+ { "Functional" },
+ expectedExceptions =
+ { NoSuchElementException.class })
public void testLastNext() throws NoSuchElementException
{
AllColsIterator it = new AllColsIterator(0, 3, hiddenCols);
* Test iterator throws UnsupportedOperationException on call to remove
*/
@Test(
- groups = { "Functional" },
- expectedExceptions = { UnsupportedOperationException.class })
+ groups =
+ { "Functional" },
+ expectedExceptions =
+ { UnsupportedOperationException.class })
public void testRemove() throws UnsupportedOperationException
{
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");
+ }
}