commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r209642 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
Date Thu, 07 Jul 2005 20:16:26 GMT
Author: rdonkin
Date: Thu Jul  7 13:16:25 2005
New Revision: 209642

URL: http://svn.apache.org/viewcvs?rev=209642&view=rev
Log:
Tweaked test to improve portability across JVMs. (Added sorting of resource to ensure known
order.)

Modified:
    jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java

Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java?rev=209642&r1=209641&r2=209642&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
(original)
+++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ParentFirstTestCase.java
Thu Jul  7 13:16:25 2005
@@ -16,6 +16,7 @@
 package org.apache.commons.logging.pathable;
 
 import java.net.URL;
+import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.ArrayList;
 import java.net.URLClassLoader;
@@ -231,10 +232,17 @@
         resources = childLoader.getResources("org/apache/commons/logging/impl/Log4J12Logger.class");
         urls = toURLArray(resources);
         assertEquals("Unexpected number of Log4J12Logger.class resources found", 2, urls.length);
+        
+        // There is no gaurantee about the ordering of results returned from getResources
+        // To make this test portable across JVMs, sort the string to give them a known order
+        String[] urlsToStrings = new String[2];
+        urlsToStrings[0] = urls[0].toString();
+        urlsToStrings[1] = urls[1].toString();
+        Arrays.sort(urlsToStrings);
         assertTrue("Incorrect source for Log4J12Logger class",
-                urls[0].toString().indexOf("/commons-logging-1.") > 0);
+                urlsToStrings[0].indexOf("/commons-logging-1.") > 0);
         assertTrue("Incorrect source for Log4J12Logger class",
-                urls[1].toString().indexOf("/commons-logging-adapters-1.") > 0);
+                urlsToStrings[1].indexOf("/commons-logging-adapters-1.") > 0);
         
     }
 



---------------------------------------------------------------------
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