garydgregory commented on a change in pull request #278:
URL: https://github.com/apache/commons-io/pull/278#discussion_r717135976



##########
File path: src/test/java/org/apache/commons/io/input/BrokenInputStreamTest.java
##########
@@ -67,4 +67,18 @@ public void testSkip() {
         assertEquals(exception, assertThrows(IOException.class, () -> 
stream.skip(1)));
     }
 
+    @Test
+    public void testTryWithResources() {
+        IOException thrown = assertThrows(IOException.class, () -> {

Review comment:
       Use final where you can.

##########
File path: src/test/java/org/apache/commons/io/input/BrokenReaderTest.java
##########
@@ -86,4 +86,19 @@ public void testSkip() {
         assertEquals(exception, assertThrows(IOException.class, () -> 
brokenReader.skip(1)));
     }
 
+    @Test
+    public void testTryWithResources() {
+        IOException thrown = assertThrows(IOException.class, () -> {
+            try (Reader newReader = new BrokenReader()) {
+                newReader.read();
+            }
+        });
+        assertEquals("Broken reader", thrown.getMessage());
+
+        Throwable[] suppressed = thrown.getSuppressed();

Review comment:
       Use final where you can.

##########
File path: src/main/java/org/apache/commons/io/output/BrokenWriter.java
##########
@@ -54,7 +55,17 @@ public BrokenWriter() {
      * @param exception the exception to be thrown
      */
     public BrokenWriter(final IOException exception) {
-        this.exception = exception;
+        this(() -> exception);
+    }
+
+    /**
+     * Creates a new writer that always throws an {@link IOException}.
+     *
+     * @param exceptionSupplier a supplier for the exception to be thrown

Review comment:
       End sentences in a period.
   




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


Reply via email to