commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgoes...@apache.org
Subject svn commit: r1200561 - /commons/proper/email/trunk/src/test/org/apache/commons/mail/resolver/DataSourceUrlResolverTest.java
Date Thu, 10 Nov 2011 21:24:11 GMT
Author: sgoeschl
Date: Thu Nov 10 21:24:10 2011
New Revision: 1200561

URL: http://svn.apache.org/viewvc?rev=1200561&view=rev
Log:
[EMAIL-108] Cleaned up the test

Modified:
    commons/proper/email/trunk/src/test/org/apache/commons/mail/resolver/DataSourceUrlResolverTest.java

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/resolver/DataSourceUrlResolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/resolver/DataSourceUrlResolverTest.java?rev=1200561&r1=1200560&r2=1200561&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/resolver/DataSourceUrlResolverTest.java
(original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/resolver/DataSourceUrlResolverTest.java
Thu Nov 10 21:24:10 2011
@@ -27,7 +27,7 @@ import java.io.InputStream;
 import java.net.URL;
 
 /**
- * JUnit test case for DateSourceResolver.
+ * JUnit test case for DataSourceUrlResolver.
  *
  * @since 1.3
  */
@@ -41,15 +41,26 @@ public class DataSourceUrlResolverTest e
         super(name);
     }
 
+    /**
+     * Shows how the DataSourceUrlResolver can resolve files as well but this should
+     * be done using a DataSourceFileResolver.
+     *
+     * @throws Exception the test failed
+     */
     public void testResolvingFilesLenient() throws Exception
     {
         DataSourceResolver dataSourceResolver = new DataSourceUrlResolver(new File("./src/test").toURI().toURL(),
true);
         assertTrue(toByteArray(dataSourceResolver.resolve("images/asf_logo_wide.gif")).length
== IMG_SIZE);
-        assertTrue(toByteArray(dataSourceResolver.resolve("/images/asf_logo_wide.gif")).length
== IMG_SIZE);
         assertTrue(toByteArray(dataSourceResolver.resolve("./images/asf_logo_wide.gif")).length
== IMG_SIZE);
         assertNull(dataSourceResolver.resolve("./images/does-not-exist.gif"));
+        assertNull(dataSourceResolver.resolve("/images/asf_logo_wide.gif"));
     }
 
+    /**
+     * Tests resolving resources over HTTP.
+     *
+     * @throws Exception the test failed
+     */
     public void testResolvingHttpLenient() throws Exception
     {
         DataSourceResolver dataSourceResolver = new DataSourceUrlResolver(new URL("http://www.apache.org"),
true);
@@ -60,24 +71,11 @@ public class DataSourceUrlResolverTest e
         assertNull(toByteArray(dataSourceResolver.resolve("/images/does-not-exist.gif")));
     }
 
-
-    public void testResolvingClassPathNonLenient() throws Exception
-    {
-        DataSourceResolver dataSourceResolver = new DataSourceUrlResolver(new File("./src/test").toURI().toURL());
-        assertNotNull(dataSourceResolver.resolve("images/asf_logo_wide.gif"));
-
-        try
-        {
-            dataSourceResolver.resolve("asf_logo_wide.gif");
-            fail("Expecting an IOException");
-        }
-        catch(IOException e)
-        {
-            // expected
-            return;
-        }
-    }
-
+    /**
+     * Tests resolving resources over HTTP.
+     *
+     * @throws Exception the test failed
+     */
     public void testResolvingHttpNonLenient() throws Exception
     {
         DataSourceResolver dataSourceResolver = new DataSourceUrlResolver(new URL("http://www.apache.org"),
false);



Mime
View raw message