[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:43:14 EST 2013


Author: scantor
Date: Tue Jan 29 23:43:14 2013
New Revision: 3177

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3177&view=rev
Log:
Complete port of java-xmltooling r743, JXT-82

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=3177&r1=3176&r2=3177&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:43:14 2013
@@ -212,4 +212,31 @@
         List<SimpleXMLObject> sublist = (List<SimpleXMLObject>) indexedList.subList(type1);
         Assert.assertTrue(child3 == sublist.get(sublist.lastIndexOf(child3)));
     }
+    
+    public void testSublistClear() {
+        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);
+        
+        SimpleXMLObject child4 = sxoBuilder.buildObject(SimpleXMLObject.ELEMENT_NAME, type1);
+        indexedList.add(child4);
+        
+        Assert.assertEquals(4, indexedList.size());
+        
+        List<SimpleXMLObject> sublist = (List<SimpleXMLObject>) indexedList.subList(type1);
+        Assert.assertEquals(3, sublist.size());
+        
+        sublist.clear();
+        Assert.assertEquals(0, sublist.size());
+        Assert.assertEquals(1, indexedList.size());
+        Assert.assertTrue(indexedList.contains(child2));
+    }
 }



More information about the commits mailing list