[jboss-svn-commits] JBoss Common SVN: r2724 - in jbossxb/trunk/src/test: resources/org/jboss/test/xb/builder/object/mc/test and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 5 12:05:02 EST 2008


Author: adrian at jboss.org
Date: 2008-03-05 12:05:02 -0500 (Wed, 05 Mar 2008)
New Revision: 2724

Added:
   jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithValues.xml
Modified:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CollectionTestCase.java
Log:
Add a test for a collection with multiple values

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CollectionTestCase.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CollectionTestCase.java	2008-03-05 16:56:31 UTC (rev 2723)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/object/mc/test/CollectionTestCase.java	2008-03-05 17:05:02 UTC (rev 2724)
@@ -21,6 +21,7 @@
 */
 package org.jboss.test.xb.builder.object.mc.test;
 
+import java.util.Iterator;
 import java.util.Set;
 
 import junit.framework.Test;
@@ -81,6 +82,14 @@
       assertValue("Value", getValue(collection));
    }
    
+   public void testCollectionWithValues() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertValues(collection, "Value1", "Value2", "Value3");
+   }
+   
    public void testCollectionWithInjection() throws Exception
    {
       AbstractCollectionMetaData collection = getCollection();
@@ -159,6 +168,16 @@
       return (ValueMetaData) collection.iterator().next();
    }
    
+   protected void assertValues(AbstractCollectionMetaData collection, String... values)
+   {
+      assertEquals(values.length, collection.size());
+      Iterator<ValueMetaData> iterator = (Iterator) collection.iterator();
+      for (int i = 0; i < values.length; ++i)
+      {
+         assertValue(values[i], iterator.next());
+      }
+   }
+   
    public static Test suite()
    {
       return suite(CollectionTestCase.class);

Added: jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithValues.xml
===================================================================
--- jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithValues.xml	                        (rev 0)
+++ jbossxb/trunk/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithValues.xml	2008-03-05 17:05:02 UTC (rev 2724)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<bean xmlns="urn:jboss:bean-deployer:2.0" class="Dummy">
+   <property name="PropertyName">
+      <collection>
+         <value>Value1</value>
+         <value>Value2</value>
+         <value>Value3</value>
+      </collection>
+   </property>
+</bean>




More information about the jboss-svn-commits mailing list