You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/07/11 23:08:27 UTC

svn commit: r1360399 - /commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderReadTests.java

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.
      */