Merge branch 'Jalview-JS/jim/JAL-3253-JAL-3418' into Jalview-JS/JAL-3253-applet
[jalview.git] / test / jalview / datamodel / AllColsIteratorTest.java
index ee82340..0dfcc21 100644 (file)
@@ -29,13 +29,13 @@ import org.testng.annotations.Test;
 
 public class AllColsIteratorTest
 {
-  ColumnSelection hiddenCols;
+  HiddenColumns hiddenCols;
   
-  @BeforeClass
+  @BeforeClass(alwaysRun = true)
   public void setup()
   {
-   hiddenCols = new ColumnSelection();
-   hiddenCols.hideColumns(2,4);
+    hiddenCols = new HiddenColumns();
+    hiddenCols.hideColumns(2, 4);
   }
   
 
@@ -82,4 +82,21 @@ public class AllColsIteratorTest
     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");
+  }
 }