[java-opensaml COMMIT] /trunk/opensaml-core/src/test/java/org/opensaml/core/xml/util/IndexedXMLObjectChildrenListTest...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jan 29 23:37:33 EST 2013


Author: scantor
Date: Tue Jan 29 23:37:33 2013
New Revision: 3176

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3176&view=rev
Log:
Complete port of java-xmltooling r742, JXT-83

Modified:
    trunk/opensaml-core/src/test/java/org/opensaml/core/xml/util/IndexedXMLObjectChildrenListTest.java

Modified: trunk/opensaml-core/src/test/java/org/opensaml/core/xml/util/IndexedXMLObjectChildrenListTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-core/src/test/java/org/opensaml/core/xml/util/IndexedXMLObjectChildrenListTest.java?rev=3176&r1=3175&r2=3176&view=diff
==============================================================================
--- trunk/opensaml-core/src/test/java/org/opensaml/core/xml/util/IndexedXMLObjectChildrenListTest.java (original)
+++ trunk/opensaml-core/src/test/java/org/opensaml/core/xml/util/IndexedXMLObjectChildrenListTest.java Tue Jan 29 23:37:33 2013
@@ -175,4 +175,41 @@
 
         }
     }
+
+    /**
+     *  Test sublist  indexOf method.
+     */
+    public void testSublistIndexOf() {
+        SimpleXMLObject parentObject = sxoBuilder.buildObject();
+        IndexedXMLObjectChildrenList<XMLObject> indexedList = new IndexedXMLObjectChildrenList<XMLObject>(parentObject);
+
+        SimpleXMLObject child1 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child1);
+
+        SimpleXMLObject child2 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type2);
+        indexedList.add(child2);
+        
+        List<SimpleXMLObject> sublist = (List<SimpleXMLObject>) indexedList.subList(type2);
+        Assert.assertTrue(child2 == sublist.get(sublist.indexOf(child2)));
+    }
+    
+    /**
+     *  Test sublist  lastIndexOf method.
+     */
+    public void testSublistLastIndexOf() {
+        SimpleXMLObject parentObject = sxoBuilder.buildObject();
+        IndexedXMLObjectChildrenList<XMLObject> indexedList = new IndexedXMLObjectChildrenList<XMLObject>(parentObject);
+
+        SimpleXMLObject child1 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child1);
+
+        SimpleXMLObject child2 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type2);
+        indexedList.add(child2);
+        
+        SimpleXMLObject child3 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child3);
+        
+        List<SimpleXMLObject> sublist = (List<SimpleXMLObject>) indexedList.subList(type1);
+        Assert.assertTrue(child3 == sublist.get(sublist.lastIndexOf(child3)));
+    }
 }



More information about the commits mailing list