svn commit: r190315 - /jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r190315 - /jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java

rdonkin
Author: rdonkin
Date: Sun Jun 12 13:34:17 2005
New Revision: 190315

URL: http://svn.apache.org/viewcvs?rev=190315&view=rev
Log:
Improved consistency across JVMs.

Modified:
    jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java

Modified: jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java?rev=190315&r1=190314&r2=190315&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java (original)
+++ jakarta/commons/proper/betwixt/branches/RELEASE_0_6_1_BRANCH/src/test/org/apache/commons/betwixt/recursion/TestSharedIDGeneration.java Sun Jun 12 13:34:17 2005
@@ -15,6 +15,8 @@
  */
 package org.apache.commons.betwixt.recursion;
 
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
 import java.io.StringWriter;
 
 import org.apache.commons.betwixt.AbstractTestCase;
@@ -39,10 +41,30 @@
         BeanWriter writer = new BeanWriter(out);
         writer.write(hybrid);
         
+        boolean isAlienBeforePerson = false;
+        PropertyDescriptor[] propertyDescriptors = Introspector.getBeanInfo(HybridBean.class).getPropertyDescriptors();
+        
+        for(int i=0; i<propertyDescriptors.length;i++) {
+             String methodName = propertyDescriptors[i].getName();
+             if ("alien".equals(methodName)) {
+                 isAlienBeforePerson = true;
+                 break;
+             } else if ("person".equals(methodName)) {
+                 isAlienBeforePerson = false;
+                 break;
+             }
+        }
         String expected = "<?xml version='1.0'?><HybridBean id='1'>" +
-         "<alien id='2'><name id='3'><moniker>Me</moniker></name></alien>" +
-         "<person id='4'><name idref='3'/></person>" +
+         "<person id='2'><name id='3'><moniker>Me</moniker></name></person>" +
+         "<alien id='4'><name idref='3'/></alien>" +
          "</HybridBean>";
+        
+        if (isAlienBeforePerson) {
+            expected = "<?xml version='1.0'?><HybridBean id='1'>" +
+            "<alien id='2'><name id='3'><moniker>Me</moniker></name></alien>" +
+            "<person id='4'><name idref='3'/></person>" +
+            "</HybridBean>";
+        }
         
         xmlAssertIsomorphic(parseString(expected), parseString(out), true);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]