commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1326677 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
Date Mon, 16 Apr 2012 16:35:24 GMT
Author: sebb
Date: Mon Apr 16 16:35:23 2012
New Revision: 1326677

URL: http://svn.apache.org/viewvc?rev=1326677&view=rev
Log:
Add tests to ensure directory size is non-zero

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java?rev=1326677&r1=1326676&r2=1326677&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java Mon
Apr 16 16:35:23 2012
@@ -1008,7 +1008,9 @@ public class FileUtilsTestCase extends F
         
         assertTrue("Check exists", destDir.exists());
         assertTrue("Check exists", actualDestDir.exists());
-        assertEquals("Check size", FileUtils.sizeOfDirectory(srcDir), FileUtils.sizeOfDirectory(actualDestDir));
+        long srcSize = FileUtils.sizeOfDirectory(srcDir);
+        assertTrue("Size > 0", srcSize > 0);
+        assertEquals("Check size", srcSize, FileUtils.sizeOfDirectory(actualDestDir));
         assertTrue(new File(actualDestDir, "sub/A.txt").exists());
         FileUtils.deleteDirectory(destDir);
     }
@@ -1027,7 +1029,9 @@ public class FileUtilsTestCase extends F
         FileUtils.copyDirectory(srcDir, destDir);
         
         assertTrue("Check exists", destDir.exists());
-        assertEquals("Check size", FileUtils.sizeOfDirectory(srcDir), FileUtils.sizeOfDirectory(destDir));
+        long sizeOfSrcDirectory = FileUtils.sizeOfDirectory(srcDir);
+        assertTrue("Size > 0",sizeOfSrcDirectory > 0);
+        assertEquals("Check size", sizeOfSrcDirectory, FileUtils.sizeOfDirectory(destDir));
         assertTrue(new File(destDir, "sub/A.txt").exists());
         FileUtils.deleteDirectory(destDir);
     }
@@ -1046,7 +1050,9 @@ public class FileUtilsTestCase extends F
         
         FileUtils.copyDirectory(srcDir, destDir);
         
-        assertEquals(FileUtils.sizeOfDirectory(srcDir), FileUtils.sizeOfDirectory(destDir));
+        long srcSize = FileUtils.sizeOfDirectory(srcDir);
+        assertTrue("Size > 0",srcSize > 0);
+        assertEquals(srcSize, FileUtils.sizeOfDirectory(destDir));
         assertTrue(new File(destDir, "sub/A.txt").exists());
     }
 
@@ -1132,6 +1138,8 @@ public class FileUtilsTestCase extends F
         FileUtils.copyDirectory(parentDir, childDir);
         assertEquals(expectedCount, LIST_WALKER.list(grandParentDir).size());
         assertEquals(expectedSize, FileUtils.sizeOfDirectory(grandParentDir));
+        assertTrue("Count > 0", expectedCount > 0);
+        assertTrue("Size > 0", expectedSize > 0);
     }
 
     /** Test for IO-141 */
@@ -1146,6 +1154,7 @@ public class FileUtilsTestCase extends F
         FileUtils.copyDirectory(grandParentDir, childDir);
         assertEquals(expectedCount, LIST_WALKER.list(grandParentDir).size());
         assertEquals(expectedSize, FileUtils.sizeOfDirectory(grandParentDir));
+        assertTrue("Size > 0",expectedSize > 0);
     }
 
     /** Test for IO-217 FileUtils.copyDirectoryToDirectory makes infinite loops */



Mime
View raw message