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/06/03 21:29:05 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_r889363755


##########
src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTest.java:
##########
@@ -350,6 +358,22 @@ public void testWriteZero(final String baosName, final BAOSFactory<?> baosFactor
         }
     }
 
+    @Test
+    public void testToByteArrayImplAndResetImpl() throws Exception {
+        final int file_size = (1024 * 4) + 1;
+        final byte[] inData = TestUtils.generateTestData(file_size);
+        try (InputStream in = new ByteArrayInputStream(inData)) {
+            try (ByteArrayOutputStream baout = new ByteArrayOutputStream()) {
+                try (Writer writer = new OutputStreamWriter(baout, StandardCharsets.US_ASCII)) {
+                    CopyUtils.copy(in, writer);
+                    writer.flush();
+                }
+                baout.reset();
+                Assertions.assertEquals("", baout.toString());

Review Comment:
   No need for Assertions prefix static in a test method. Use the other methods in this file as a style guide.



##########
src/test/java/org/apache/commons/io/output/ByteArrayOutputStreamTest.java:
##########
@@ -350,6 +358,22 @@ public void testWriteZero(final String baosName, final BAOSFactory<?> baosFactor
         }
     }
 
+    @Test
+    public void testToByteArrayImplAndResetImpl() throws Exception {
+        final int file_size = (1024 * 4) + 1;

Review Comment:
   - No underscore in local variable names. 
   - No need for spelling out 4097 in an expression.



-- 
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