Repository: commons-compress
Updated Branches:
  refs/heads/master e00ea6c15 -> 083dd8ca0


Missing Test Case for octal to binary conversion

In order to ensure that there is at least one test that will enter the octal 
string conversion, we  added a test that for value = Long.MAX\_VALUE with an 
insufficient small length of 8 for the buffer. This will check that the value 
can not be converted into an octal and throw an exception with an appropriate 
message which we check. This missing test case was an outcome of our mutation 
testing analysis performed on your system.


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/9f5af267
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/9f5af267
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/9f5af267

Branch: refs/heads/master
Commit: 9f5af267e8c143e16f8b20fddb02ada096ee9df8
Parents: e00ea6c
Author: Ioana Leontiuc <i.leont...@student.tudelft.nl>
Authored: Wed Aug 2 16:02:23 2017 +0200
Committer: Stefan Bodewig <bode...@apache.org>
Committed: Fri Aug 18 21:44:14 2017 +0200

----------------------------------------------------------------------
 .../commons/compress/archivers/tar/TarUtilsTest.java      | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/9f5af267/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java 
b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
index 87f6b27..3de7aed 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/TarUtilsTest.java
@@ -367,5 +367,15 @@ public class TarUtilsTest {
         };
         assertEquals(expected, TarUtils.parseOctalOrBinary(buffer, 0, 
buffer.length));
     }
+    
+    @Test
+    public void testRoundTripOctalOrBinary8_ValueTooBigForBinary() {
+        try {
+               checkRoundTripOctalOrBinary(Long.MAX_VALUE, 8);
+            fail("Should throw exception - value is too long to fit buffer of 
this len");
+        } catch (IllegalArgumentException e) {
+            assertEquals("Value 9223372036854775807 is too large for 8 byte 
field.", e.getMessage());
+        }
+    }
 
 }

Reply via email to