This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git


The following commit(s) were added to refs/heads/master by this push:
     new dbaf4956 Reuse own code.
dbaf4956 is described below

commit dbaf49562407601cf63639f0bb718806c9605e97
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Apr 4 14:44:44 2022 -0400

    Reuse own code.
---
 .../java/org/apache/commons/io/IOUtilsTest.java    | 45 ++++------------------
 1 file changed, 7 insertions(+), 38 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/IOUtilsTest.java 
b/src/test/java/org/apache/commons/io/IOUtilsTest.java
index e1842d6e..37c5cf5c 100644
--- a/src/test/java/org/apache/commons/io/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/IOUtilsTest.java
@@ -65,6 +65,7 @@ import org.apache.commons.io.input.StringInputStream;
 import org.apache.commons.io.output.AppendableWriter;
 import org.apache.commons.io.output.CountingOutputStream;
 import org.apache.commons.io.output.NullOutputStream;
+import org.apache.commons.io.output.NullWriter;
 import org.apache.commons.io.output.StringBuilderWriter;
 import org.apache.commons.io.test.TestUtils;
 import org.apache.commons.io.test.ThrowOnCloseReader;
@@ -251,49 +252,17 @@ public class IOUtilsTest {
 
     @Test
     public void testAsBufferedWriter() {
-        final Writer is = new Writer() {
-            @Override
-            public void close() throws IOException {
-            }
-
-            @Override
-            public void flush() throws IOException {
-            }
-
-            @Override
-            public void write(final char[] cbuf, final int off, final int len) 
throws IOException {
-            }
-
-            @Override
-            public void write(final int b) throws IOException {
-            }
-        };
-        final BufferedWriter bis = IOUtils.buffer(is);
-        assertNotSame(is, bis);
+        final Writer nullWriter = NullWriter.INSTANCE;
+        final BufferedWriter bis = IOUtils.buffer(nullWriter);
+        assertNotSame(nullWriter, bis);
         assertSame(bis, IOUtils.buffer(bis));
     }
 
     @Test
     public void testAsBufferedWriterWithBufferSize() {
-        final Writer w = new Writer() {
-            @Override
-            public void close() throws IOException {
-            }
-
-            @Override
-            public void flush() throws IOException {
-            }
-
-            @Override
-            public void write(final char[] cbuf, final int off, final int len) 
throws IOException {
-            }
-
-            @Override
-            public void write(final int b) throws IOException {
-            }
-        };
-        final BufferedWriter bw = IOUtils.buffer(w, 2024);
-        assertNotSame(w, bw);
+        final Writer nullWriter = NullWriter.INSTANCE;
+        final BufferedWriter bw = IOUtils.buffer(nullWriter, 2024);
+        assertNotSame(nullWriter, bw);
         assertSame(bw, IOUtils.buffer(bw));
         assertSame(bw, IOUtils.buffer(bw, 1024));
     }

Reply via email to