jmark109 commented on a change in pull request #206:
URL: https://github.com/apache/commons-io/pull/206#discussion_r580300990
##########
File path:
src/test/java/org/apache/commons/io/output/DeferredFileOutputStreamTest.java
##########
@@ -365,4 +370,55 @@ private void verifyResultFile(final File testFile) {
fail("Unexpected IOException");
}
}
+
+ /**
+ * Tests the case where the amount of data falls below the threshold, and
is therefore confined to memory.
+ * Testing the getInputStream() method.
+ */
+ @ParameterizedTest(name = "initialBufferSize = {0}")
+ @MethodSource("data")
+ public void testBelowThresholdGetInputStream(final int initialBufferSize)
throws IOException {
+ final DeferredFileOutputStream dfos = new
DeferredFileOutputStream(testBytes.length + 42, initialBufferSize,
+ null);
+ try {
+ dfos.write(testBytes, 0, testBytes.length);
+ dfos.close();
+ } catch (final IOException e) {
+ fail("Unexpected IOException");
+ }
+ assertTrue(dfos.isInMemory());
+
+ try(InputStream is = dfos.toInputStream()) {
Review comment:
Fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]