Skip to content

Commit f4993d1

Browse files
author
Gary Gregory
committed
Add a test.
1 parent c1d6ad5 commit f4993d1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/test/java/org/apache/commons/io/IOUtilsTestCase.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,16 @@ public void testToByteArray_InputStream_SizeZero() throws Exception {
14751475
}
14761476
}
14771477

1478+
@Test
1479+
public void testToByteArray_InputStream_SizeOne() throws Exception {
1480+
1481+
try (FileInputStream fin = new FileInputStream(m_testFile)) {
1482+
final byte[] out = IOUtils.toByteArray(fin, 1);
1483+
assertNotNull(out, "Out cannot be null");
1484+
assertEquals(1, out.length, "Out length must be 1");
1485+
}
1486+
}
1487+
14781488
@Test
14791489
public void testToByteArray_Reader() throws IOException {
14801490
final String charsetName = "UTF-8";

0 commit comments

Comments
 (0)