garydgregory commented on a change in pull request #327: URL: https://github.com/apache/commons-io/pull/327#discussion_r807848646
########## 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: Actually it would better to also test the contents of the stream maybe by converting it to a string. So a black box test instead of a white box test. This would insure that the actual behavior is correct, not just the internal mechanism. -- 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: issues-unsubscr...@commons.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org