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 2021/01/11 07:06:33 UTC

[commons-io] branch master updated: Add a test.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new f4993d1  Add a test.
f4993d1 is described below

commit f4993d183e715738f91b644a0b142030299099f4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 11 02:06:29 2021 -0500

    Add a test.
---
 src/test/java/org/apache/commons/io/IOUtilsTestCase.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/test/java/org/apache/commons/io/IOUtilsTestCase.java b/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
index 9d9f39b..7f86b00 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTestCase.java
@@ -1476,6 +1476,16 @@ public class IOUtilsTestCase {
     }
 
     @Test
+    public void testToByteArray_InputStream_SizeOne() throws Exception {
+
+        try (FileInputStream fin = new FileInputStream(m_testFile)) {
+            final byte[] out = IOUtils.toByteArray(fin, 1);
+            assertNotNull(out, "Out cannot be null");
+            assertEquals(1, out.length, "Out length must be 1");
+        }
+    }
+
+    @Test
     public void testToByteArray_Reader() throws IOException {
         final String charsetName = "UTF-8";
         final byte[] expecteds = charsetName.getBytes(charsetName);