X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FAllRowsIteratorTest.java;fp=test%2Fjalview%2Fdatamodel%2FAllRowsIteratorTest.java;h=aeff71d036016bcfe365406f67d7edc426fc92ac;hb=18565b7cf82c50da2d6266f885fa6ebef929db79;hp=fd1d29d67c81a45b43d3f01ff9e620b14f3b1ee3;hpb=499d28231522cf0f831b4d3acf944f00c8ece3a4;p=jalview.git diff --git a/test/jalview/datamodel/AllRowsIteratorTest.java b/test/jalview/datamodel/AllRowsIteratorTest.java index fd1d29d..aeff71d 100644 --- a/test/jalview/datamodel/AllRowsIteratorTest.java +++ b/test/jalview/datamodel/AllRowsIteratorTest.java @@ -34,7 +34,7 @@ public class AllRowsIteratorTest { AlignmentI al; - Hashtable hiddenRepSequences = new Hashtable(); + Hashtable hiddenRepSequences = new Hashtable<>(); @BeforeClass public void setup() @@ -110,4 +110,21 @@ public class AllRowsIteratorTest 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"); + } + }