XBEAN-284 fix code to also compile under java6
git-svn-id: https://svn.apache.org/repos/asf/geronimo/xbean/trunk@1682418 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java b/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
index 46d50e2..111df35 100644
--- a/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
+++ b/xbean-finder/src/test/java/org/apache/xbean/finder/ClassLoadersTest.java
@@ -24,8 +24,8 @@
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 @@
@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 @@
};
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(); }
+ }
}