commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1360399 - /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
Date Wed, 11 Jul 2012 21:08:27 GMT
Author: ggregory
Date: Wed Jul 11 21:08:27 2012
New Revision: 1360399

URL: http://svn.apache.org/viewvc?rev=1360399&view=rev
Log:
Test getContent() and getContent().getContentInfo() in isolation for VFS-427: NPE on HttpFileObject.getContent().getContentInfo().
No issue yet.

Modified:
    commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java

Modified: commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java?rev=1360399&r1=1360398&r2=1360399&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
(original)
+++ commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java
Wed Jul 11 21:08:27 2012
@@ -25,6 +25,8 @@ import java.util.List;
 import junit.framework.Assert;
 
 import org.apache.commons.vfs2.Capability;
+import org.apache.commons.vfs2.FileContent;
+import org.apache.commons.vfs2.FileContentInfo;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystem;
 import org.apache.commons.vfs2.FileSystemException;
@@ -140,7 +142,7 @@ public class ProviderReadTests extends A
     public void testType() throws Exception
     {
         // Test a file
-        FileObject file = getReadFolder().resolveFile("file1.txt");
+        FileObject file = resolveFile1Txt();
         assertSame(FileType.FILE, file.getType());
         assertTrue(file.isFile());
 
@@ -241,12 +243,17 @@ public class ProviderReadTests extends A
         Assert.assertTrue(folder.isReadable());
     }
     
+    private FileObject resolveFile1Txt() throws FileSystemException
+    {
+        return getReadFolder().resolveFile("file1.txt");
+    }
+    
     /**
      * Tests can perform operations on a folder while reading from a different files.
      */
     public void testConcurrentReadFolder() throws Exception
     {
-        final FileObject file = getReadFolder().resolveFile("file1.txt");
+        final FileObject file = resolveFile1Txt();
         assertTrue(file.exists());
         final FileObject folder = getReadFolderDir1();
         assertTrue(folder.exists());
@@ -265,6 +272,24 @@ public class ProviderReadTests extends A
         }
     }
 
+    public void testContent() throws Exception
+    {
+        final FileObject file = resolveFile1Txt();
+        assertTrue(file.exists());
+        final FileContent content = file.getContent();
+        assertNotNull(content);
+    }
+
+    public void testContentInfo() throws Exception
+    {
+        final FileObject file = resolveFile1Txt();
+        assertTrue(file.exists());
+        final FileContent content = file.getContent();
+        assertNotNull(content);
+        final FileContentInfo contentInfo = content.getContentInfo();
+        assertNotNull(contentInfo);
+    }
+    
     /**
      * Tests that findFiles() works.
      */



Mime
View raw message