commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r750914 - /commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Date Fri, 06 Mar 2009 14:23:00 GMT
Author: bodewig
Date: Fri Mar  6 14:23:00 2009
New Revision: 750914

URL: http://svn.apache.org/viewvc?rev=750914&view=rev
Log:
simplify location of test files

Modified:
    commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java

Modified: commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java?rev=750914&r1=750913&r2=750914&view=diff
==============================================================================
--- commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
(original)
+++ commons/sandbox/compress/trunk/src/test/java/org/apache/commons/compress/AbstractTestCase.java
Fri Mar  6 14:23:00 2009
@@ -49,21 +49,10 @@
         dir = File.createTempFile("dir", "");
         dir.delete();
         dir.mkdir();
-
-        addURL(new File("src/test/resources").toURL());
     }
 
-    protected File getFile(String path) throws IOException {
-        URL url = getClass().getResource(path);
-        if (url == null) {
-            throw new java.io.FileNotFoundException(path + " doesn't exist");
-        }
-        try {
-            return new File(new URI(url.toString()));
-        } catch (java.net.URISyntaxException ex) {
-            // impossible since URL.toString() should always yield a valid URI
-            throw new IOException(ex.getMessage());
-        }
+    protected File getFile(String path) {
+        return new File("src/test/resources", path);
     }
 
     protected void tearDown() throws Exception {
@@ -72,26 +61,6 @@
     }
 
     /**
-     * Adds a URL to the classpath. This method is necessary when running junit
-     * tests from within eclipse.
-     * 
-     * @param url
-     *            the url to add
-     * @throws Exception
-     *             if an error occurs
-     */
-    public void addURL(URL url) throws Exception {
-        URLClassLoader classLoader = (URLClassLoader) ClassLoader
-            .getSystemClassLoader();
-        Class clazz = URLClassLoader.class;
-
-        Method method = clazz.getDeclaredMethod("addURL",
-                                                new Class[] { URL.class });
-        method.setAccessible(true);
-        method.invoke(classLoader, new Object[] { url });
-    }
-
-    /**
      * Creates an archive of 5 textbased files in several directories. The
      * archivername is the factory identifier for the archiver, for example zip,
      * tar, cpio, jar, ar. The archive is created as a temp file.



Mime
View raw message