commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r209633 - /jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
Date Thu, 07 Jul 2005 18:59:22 GMT
Author: rdonkin
Date: Thu Jul  7 11:59:21 2005
New Revision: 209633

URL: http://svn.apache.org/viewcvs?rev=209633&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/ChildFirstTestCase.java

Modified: jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java?rev=209633&r1=209632&r2=209633&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
(original)
+++ jakarta/commons/proper/logging/trunk/src/test/org/apache/commons/logging/pathable/ChildFirstTestCase.java
Thu Jul  7 11:59:21 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;
@@ -241,10 +242,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