Author: nextgens
Date: 2007-11-20 21:19:22 +0000 (Tue, 20 Nov 2007)
New Revision: 15888

Modified:
   trunk/freenet/test/freenet/support/SimpleFieldSetTest.java
Log:
Unit testing:
        update the test for SimpleFieldSet

Modified: trunk/freenet/test/freenet/support/SimpleFieldSetTest.java
===================================================================
--- trunk/freenet/test/freenet/support/SimpleFieldSetTest.java  2007-11-20 
21:18:10 UTC (rev 15887)
+++ trunk/freenet/test/freenet/support/SimpleFieldSetTest.java  2007-11-20 
21:19:22 UTC (rev 15888)
@@ -682,7 +682,7 @@
                retValue &= (actualLength==aStringPairsArray.length);
                return retValue;
        }
-       
+
        /**
         * Tests the Iterator given for the
         * SimpleFieldSet class.
@@ -704,4 +704,22 @@
                Iterator itr = methodSFS.keyIterator(methodPrefix);
                
assertTrue(areAllContainedKeys(SAMPLE_STRING_PAIRS,methodPrefix,itr));  
        }
+        
+        /**
+        * Tests the toplevelIterator given for the
+        * SimpleFieldSet class.
+        * It tests hasNext() and next() methods.
+         * 
+         * TODO: improve the test
+        */
+       public void testToplevelKeyIterator() {
+               SimpleFieldSet methodSFS = sfsFromSampleStringPairs();
+               Iterator itr = methodSFS.toplevelKeyIterator();
+               
+                for(int i=0; i<3; i++) {
+                    assertTrue(itr.hasNext());
+                    assertTrue(isAKey(SAMPLE_STRING_PAIRS, "", 
(String)itr.next()));
+                }
+                assertFalse(itr.hasNext());
+       }
 }


Reply via email to