Add BrokenReader.INSTANCE.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -45,6 +45,12 @@ The <action> type attribute can be add,update,fix,remove.
</properties>
<body>
+ <release version="2.13.0" date="2021-MM-DD" description="Java 8 required.">
+ <!-- ADD -->
+ <action dev="ggregory" type="add" due-to="Gary Gregory">
+ Add BrokenReader.INSTANCE.
+ </action>
+ </release>
<release version="2.11.0" date="2021-07-09" description="Java 8 required.">
<!-- FIX -->
<action issue="IO-741" dev="ggregory" type="fix" due-to="Zach Sherman">

MODIFY
src/main/java/org/apache/commons/io/input/BrokenReader.java
src/main/java/org/apache/commons/io/input/BrokenReader.java
import java.io.Reader;
/**
- * Broken reader. This reader always throws an {@link IOException} from
- * all the {@link Reader} methods where the exception is declared.
+ * Broken reader. This reader always throws an {@link IOException} from all the {@link Reader} methods where the exception is declared.
* <p>
- * This class is mostly useful for testing error handling in code that uses a
- * reader.
+ * This class is mostly useful for testing error handling in code that uses a reader.
* </p>
*
* @since 2.7
*/
public class BrokenReader extends Reader {
+ /**
+ * A singleton instance using a default IOException.
+ *
+ * @since 2.12.0
+ */
+ public static final BrokenReader INSTANCE = new BrokenReader();
+
/**
* The exception that is thrown by all methods of this class.
*/

MODIFY
src/test/java/org/apache/commons/io/input/BrokenReaderTest.java
src/test/java/org/apache/commons/io/input/BrokenReaderTest.java
package org.apache.commons.io.input;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
@@ -51,6 +52,11 @@ public void testClose() {
}
}
+ @Test
+ public void testInstance() {
+ assertNotNull(BrokenReader.INSTANCE);
+ }
+
@Test
public void testMark() {
try {

Add BrokenReader.INSTANCE.