Author: veithen
Date: Tue Jul 28 20:07:59 2015
New Revision: 1693152

URL: http://svn.apache.org/r1693152
Log:
Fix a flaky test: the order of methods returned by the reflection API is not 
deterministic.

Modified:
    
axis/axis1/java/trunk/axis-rt-core/src/test/java/test/servicedesc/TestServiceDesc.java

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/test/java/test/servicedesc/TestServiceDesc.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/test/java/test/servicedesc/TestServiceDesc.java?rev=1693152&r1=1693151&r2=1693152&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/test/java/test/servicedesc/TestServiceDesc.java
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/test/java/test/servicedesc/TestServiceDesc.java
 Tue Jul 28 20:07:59 2015
@@ -15,6 +15,8 @@
  */
 package test.servicedesc;
 
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 
 import junit.framework.TestCase;
@@ -30,16 +32,21 @@ public class TestServiceDesc extends Tes
 
         desc.loadServiceDescByIntrospection(ServiceClass.class);
 
-        List operations = desc.getOperations();
+        OperationDesc[] operations = 
(OperationDesc[])desc.getOperations().toArray(new OperationDesc[0]);
+        Arrays.sort(operations, new Comparator() {
+            public int compare(Object o1, Object o2) {
+                return 
((OperationDesc)o1).getName().compareTo(((OperationDesc)o2).getName());
+            }
+        });
 
         assertTrue(operations != null);
         assertEquals("invalid number of registered operations",
-                     2, operations.size());
+                     2, operations.length);
         
         OperationDesc operation;
         List faults;
 
-        operation = (OperationDesc)operations.get(0);
+        operation = operations[0];
         assertEquals("doIt1", operation.getName());
 
         faults = operation.getFaults();
@@ -48,7 +55,7 @@ public class TestServiceDesc extends Tes
         assertEquals("invalid number of registered faults", 
                      2, faults.size());
 
-        operation = (OperationDesc)operations.get(1);
+        operation = operations[1];
         assertEquals("doIt2", operation.getName());
 
         faults = operation.getFaults();


Reply via email to