commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r224661 - in /jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt: MixedUpdatersBean.betwixt MixedUpdatersBean.java TestXmlToBean.java
Date Sun, 24 Jul 2005 21:08:22 GMT
Author: rdonkin
Date: Sun Jul 24 14:08:19 2005
New Revision: 224661

URL: http://svn.apache.org/viewcvs?rev=224661&view=rev
Log:
Additional unit test. Submitted by John M. Issue 35723.

Modified:
    jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.betwixt
    jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.java
    jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/TestXmlToBean.java

Modified: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.betwixt
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.betwixt?rev=224661&r1=224660&r2=224661&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.betwixt
(original)
+++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.betwixt
Sun Jul 24 14:08:19 2005
@@ -24,7 +24,10 @@
         <element name='bad-items'>
             <element name='bad-item' property='badItems' updater='badItemAdder'/>
         </element>
-        <element name='private-property' property='privateProperty' updater='setPrivateProperty'
forceAccessible="true"/>
+        <element name='private-property' property='privateProperty' updater='setPrivateProperty'
forceAccessible='true'/>
+        <element name='private-items'>
+            <element name='private-item' property='privateItems' updater='addPrivateItem'
forceAccessible='true'/>
+        </element>
         <addDefaults/>
   </element>
 </info>

Modified: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.java?rev=224661&r1=224660&r2=224661&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.java
(original)
+++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/MixedUpdatersBean.java
Sun Jul 24 14:08:19 2005
@@ -32,7 +32,8 @@
     private List items = new ArrayList();
     private List badItems = new ArrayList();
     private String privateProperty;
-    
+    private List privateItems = new ArrayList(3);
+
 //-------------------------- Constructors
 
     public MixedUpdatersBean() {}
@@ -84,5 +85,13 @@
     }	
     public void privatePropertyWorkaroundSetter(String privateProp) {
         this.privateProperty = privateProp;
+    }
+
+    public List getPrivateItems() {
+        return privateItems;
+    }
+
+    private void addPrivateItem(String item) {
+        privateItems.add(item);
     }
 }

Modified: jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/TestXmlToBean.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/TestXmlToBean.java?rev=224661&r1=224660&r2=224661&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/TestXmlToBean.java
(original)
+++ jakarta/commons/proper/betwixt/trunk/src/test/org/apache/commons/betwixt/dotbetwixt/TestXmlToBean.java
Sun Jul 24 14:08:19 2005
@@ -58,10 +58,11 @@
         bean.addItem("Life");
         bean.badItemAdder("Death");
         bean.privatePropertyWorkaroundSetter("Private");
+        bean.getPrivateItems().add("private item 1");
 
         StringWriter out = new StringWriter();
         out.write("<?xml version='1.0'?>");
-        BeanWriter writer = new BeanWriter(out);;
+        BeanWriter writer = new BeanWriter(out);
         
         writer.getBindingConfiguration().setMapIDs(false);
         writer.write(bean);
@@ -69,7 +70,9 @@
     	String xml = "<?xml version='1.0'?><mixed><name>Lov</name><bad-name>Hate</bad-name>"
           + "<items><item>White</item><item>Life</item></items>"
           + "<bad-items><bad-item>Black</bad-item><bad-item>Death</bad-item></bad-items>"
-          + "<private-property>Private</private-property></mixed>";
+          + "<private-property>Private</private-property>"
+          + "<private-items><private-item>private item 1</private-item></private-items>"
+          + "</mixed>";
         
         xmlAssertIsomorphicContent(
                     parseString(xml),
@@ -94,7 +97,11 @@
         //assertEquals("Bad item one wrong", "Black", badItems.get(0));
         //assertEquals("Bad item two wrong", "Death", badItems.get(1));       
         assertEquals("Private property incorrect", "Private", bean.getPrivateProperty());
-        
+
+        //this shows that a private adder can be utilized
+        List privateItems = bean.getPrivateItems();
+        assertEquals("Wrong number of private items", 1, privateItems.size());
+        //TODO can't assert contents - gets the right number of items, but each is null (badItems,
too)
     }
 
     



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message