incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r802689 - /sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java
Date Mon, 10 Aug 2009 08:22:38 GMT
Author: cziegeler
Date: Mon Aug 10 08:22:37 2009
New Revision: 802689

URL: http://svn.apache.org/viewvc?rev=802689&view=rev
Log:
SLING-1077 :  Add iterator based tests.

Modified:
    sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java

Modified: sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java?rev=802689&r1=802688&r2=802689&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrPropertyMapTest.java
Mon Aug 10 08:22:37 2009
@@ -19,6 +19,7 @@
  */
 import java.util.Calendar;
 import java.util.Date;
+import java.util.Iterator;
 
 import javax.jcr.Node;
 import javax.jcr.Property;
@@ -238,4 +239,23 @@
         final ValueMap vm = this.createPropertyMap(this.rootNode);
         assertEquals("value", vm.get("a/a"));
     }
+
+    public void testIerators() throws Exception {
+        this.rootNode.setProperty(ISO9075.encode("a/a"), "value");
+        final ValueMap vm = this.createPropertyMap(this.rootNode);
+        assertTrue(vm.containsKey("a/a"));
+        search(vm.keySet().iterator(), "a/a");
+        search(vm.values().iterator(), "value");
+    }
+
+    protected void search(Iterator<?> i, Object value) {
+        boolean found = false;
+        while ( !found && i.hasNext() ) {
+            final Object current = i.next();
+            found = current.equals(value);
+        }
+        if ( !found ) {
+            fail("Value " + value + " is not found in iterator.");
+        }
+    }
 }



Mime
View raw message