Repository: commons-io
Updated Branches:
  refs/heads/master 9e801d916 -> 0cbb22ddd


Add more varied input data to tests in FileSystemUtilsTestCase (closes #48)

Add tests with larger and smaller disk spaces on Windows

(side effect: close #57, close #45)


Project: http://git-wip-us.apache.org/repos/asf/commons-io/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-io/commit/0cbb22dd
Tree: http://git-wip-us.apache.org/repos/asf/commons-io/tree/0cbb22dd
Diff: http://git-wip-us.apache.org/repos/asf/commons-io/diff/0cbb22dd

Branch: refs/heads/master
Commit: 0cbb22ddd4cd4bd356dad0e8dca8dfe1080aae0f
Parents: 9e801d9
Author: Owolabi Legunsen <legun...@illinois.edu>
Authored: Tue Oct 17 02:03:01 2017 -0500
Committer: pascalschumacher <pascalschumac...@gmx.net>
Committed: Fri Jun 8 18:45:35 2018 +0200

----------------------------------------------------------------------
 .../commons/io/FileSystemUtilsTestCase.java     | 40 ++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-io/blob/0cbb22dd/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java 
b/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
index 9baa50d..c78ae0f 100644
--- a/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
@@ -181,6 +181,46 @@ public class FileSystemUtilsTestCase {
 
     //-----------------------------------------------------------------------
     @Test
+    public void testGetFreeSpaceWindows_String_ParseCommaFormatBytes_Big() 
throws Exception {
+        // test with very large free space
+        final String lines =
+                " Volume in drive C is HDD\n" +
+                        " Volume Serial Number is XXXX-YYYY\n" +
+                        "\n" +
+                        " Directory of C:\\Documents and Settings\\Xxxx\n" +
+                        "\n" +
+                        "19/08/2005  22:43    <DIR>          .\n" +
+                        "19/08/2005  22:43    <DIR>          ..\n" +
+                        "11/08/2005  01:07                81 
build.properties\n" +
+                        "17/08/2005  21:44    <DIR>          Desktop\n" +
+                        "               7 File(s)        180,260 bytes\n" +
+                        "              10 Dir(s)  141,411,551,232 bytes free";
+        final FileSystemUtils fsu = new MockFileSystemUtils(0, lines);
+        assertEquals(141411551232L, fsu.freeSpaceWindows("", -1));
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void testGetFreeSpaceWindows_String_ParseCommaFormatBytes_Small() 
throws Exception {
+        // test with very large free space
+        final String lines =
+                " Volume in drive C is HDD\n" +
+                        " Volume Serial Number is XXXX-YYYY\n" +
+                        "\n" +
+                        " Directory of C:\\Documents and Settings\\Xxxx\n" +
+                        "\n" +
+                        "19/08/2005  22:43    <DIR>          .\n" +
+                        "19/08/2005  22:43    <DIR>          ..\n" +
+                        "11/08/2005  01:07                81 
build.properties\n" +
+                        "17/08/2005  21:44    <DIR>          Desktop\n" +
+                        "               7 File(s)        180,260 bytes\n" +
+                        "              10 Dir(s)  1,232 bytes free";
+        final FileSystemUtils fsu = new MockFileSystemUtils(0, lines);
+        assertEquals(1232L, fsu.freeSpaceWindows("", -1));
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
     public void testGetFreeSpaceWindows_String_EmptyPath() throws Exception {
         final String lines =
                 " Volume in drive C is HDD\n" +

Reply via email to