Author: ggregory
Date: Wed Nov  2 22:24:35 2011
New Revision: 1196830

URL: http://svn.apache.org/viewvc?rev=1196830&view=rev
Log:
Fix my buggy test.

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

Modified: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java?rev=1196830&r1=1196829&r2=1196830&view=diff
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/test/ProviderWriteTests.java
 Wed Nov  2 22:24:35 2011
@@ -655,49 +655,50 @@ public class ProviderWriteTests
         final FileObject scratchFolder = createScratchFolder();
 
         // Create direct child of the test folder
-        final FileObject file = scratchFolder.resolveFile("file1.txt");
-        assertTrue(!file.exists());
+        final FileObject fileSource = scratchFolder.resolveFile("file1.txt");
+        assertTrue(!fileSource.exists());
 
         // Create the source file
-        final String content = "Here is some sample content for the file.  
Blah Blah Blah.";
-        final OutputStream os = file.getContent().getOutputStream();
+        final String expectedString = "Here is some sample content for the 
file.  Blah Blah Blah.";
+        final OutputStream expectedOutputStream = 
fileSource.getContent().getOutputStream();
         try
         {
-            os.write(content.getBytes("utf-8"));
+            expectedOutputStream.write(expectedString.getBytes("utf-8"));
         }
         finally
         {
-            os.close();
+            expectedOutputStream.close();
         }
 
-        assertSameContent(content, file);
+        assertSameContent(expectedString, fileSource);
 
         // Make sure we can copy the new file to another file on the same 
filesystem
-        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
-        assertTrue(!fileCopy.exists());
+        FileObject fileTarget = scratchFolder.resolveFile("file1copy.txt");
+        assertTrue(!fileTarget.exists());
 
-        //fileCopy.copyFrom(file, Selectors.SELECT_SELF);
-        //assertSameContent(content, fileCopy);
-        final FileContent sourceContent = file.getContent();
+        final FileContent contentSource = fileSource.getContent();
         //
-        sourceContent.write(fileCopy.getContent());
-        assertSameContent(content, fileCopy);
+        // Tests FileContent#write(FileContent)
+        contentSource.write(fileTarget.getContent());
+        assertSameContent(expectedString, fileTarget);
         //
-        OutputStream output = sourceContent.getOutputStream();
+        // Tests FileContent#write(OutputStream)
+        OutputStream outputStream = fileTarget.getContent().getOutputStream();
         try {
-            sourceContent.write(output);
-            assertSameContent(content, fileCopy);            
+            contentSource.write(outputStream);
         } finally {
-            output.close();
+            outputStream.close();
         }
+        assertSameContent(expectedString, fileTarget);            
         //
-        output = sourceContent.getOutputStream();
+        // Tests FileContent#write(OutputStream, int)
+        outputStream = fileTarget.getContent().getOutputStream();
         try {
-            sourceContent.write(output, 1234);
-            assertSameContent(content, fileCopy);            
+            contentSource.write(outputStream, 1234);
         } finally {
-            output.close();
+            outputStream.close();
         }
+        assertSameContent(expectedString, fileTarget);            
     }
 
     /**


Reply via email to