code-ferry commented on a change in pull request #327:
URL: https://github.com/apache/commons-io/pull/327#discussion_r816699684
##########
File path:
src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTest.java
##########
@@ -350,6 +353,31 @@ public void testWriteZero(final String baosName, final
BAOSFactory<?> baosFactor
}
}
+ @ParameterizedTest(name = "[{index}] {0}")
+ @ValueSource(ints = {1024, 64})
+ public void testPrivateFieldOfCurrentBufferIndex(int size) throws
NoSuchFieldException, IllegalAccessException {
+ // Use the default size and custom size.
+ final ByteArrayOutputStream os = new ByteArrayOutputStream(size);
+
+ // Get private field object.
+ final Field field =
AbstractByteArrayOutputStream.class.getDeclaredField("currentBufferIndex");
Review comment:
@garydgregory
In general, unit tests should be white box tests. But I puzzled with this
PR. Change the position of the variable currentBufferIndex have no effect on
the results of public methods, such as write and reset, so I used black box
tests to illustrate the problem.
In other words, this PR is not necessary. I will close this issue.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]