You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2022/05/22 20:09:25 UTC

[GitHub] [commons-io] garydgregory commented on a diff in pull request #358: Add test for AbstractByteArrayOutputStream.resetImpl and .toByteArrayImpl

garydgregory commented on code in PR #358:
URL: https://github.com/apache/commons-io/pull/358#discussion_r878919402


##########
src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTest.java:
##########
@@ -350,6 +360,22 @@ public void testWriteZero(final String baosName, final BAOSFactory<?> baosFactor
         }
     }
 
+    private static final int FILE_SIZE = (1024 * 4) + 1;
+    private final byte[] inData = TestUtils.generateTestData(FILE_SIZE);
+
+    @Test
+    public void testToByteArrayImplAndResetImpl() throws Exception {
+        InputStream in = new ByteArrayInputStream(inData);

Review Comment:
   Use try with resources
   



##########
src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTest.java:
##########
@@ -350,6 +360,22 @@ public void testWriteZero(final String baosName, final BAOSFactory<?> baosFactor
         }
     }
 
+    private static final int FILE_SIZE = (1024 * 4) + 1;
+    private final byte[] inData = TestUtils.generateTestData(FILE_SIZE);

Review Comment:
   These data do not need to be tracked for all tests. Move them inside the one method that use them.



-- 
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-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org