geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1682418 - /geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
Date Fri, 29 May 2015 11:18:04 GMT
Author: struberg
Date: Fri May 29 11:18:03 2015
New Revision: 1682418

URL: http://svn.apache.org/r1682418
Log:
XBEAN-284 fix code to also compile under java6

Modified:
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java

Modified: geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java?rev=1682418&r1=1682417&r2=1682418&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
Fri May 29 11:18:03 2015
@@ -24,8 +24,8 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Enumeration;
+import java.util.NoSuchElementException;
 
-import static java.util.Collections.emptyEnumeration;
 import static java.util.Collections.enumeration;
 import static java.util.Collections.singleton;
 import static org.junit.Assert.assertEquals;
@@ -62,13 +62,13 @@ public class ClassLoadersTest {
 
             @Override
             public Enumeration<URL> getResources(final String name) throws IOException
{
-                return emptyEnumeration();
+                return EmptyEnumeration.EMPTY_ENUMERATION;
             }
         }) {
             @Override
             public Enumeration<URL> getResources(final String name) throws IOException
{
                 if ("META-INF".equals(name)) {
-                    return emptyEnumeration();
+                    return EmptyEnumeration.EMPTY_ENUMERATION;
                 }
                 return enumeration(singleton(new URL("jar:file:/tmp/app.jar!/")));
             }
@@ -85,4 +85,12 @@ public class ClassLoadersTest {
         };
         assertEquals(1, ClassLoaders.findUrls(loader).size());
     }
+
+    public static class EmptyEnumeration<E> implements Enumeration<E> {
+        public static final EmptyEnumeration EMPTY_ENUMERATION
+            = new EmptyEnumeration();
+
+        public boolean hasMoreElements() { return false; }
+        public E nextElement() { throw new NoSuchElementException(); }
+    }
 }



Mime
View raw message