Make ObservableInputStream.getObservers() public.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -160,6 +160,9 @@ The <action> type attribute can be add,update,fix,remove.
<action dev="ggregory" type="add" due-to="Gary Gregory">
Add and use ObservableInputStream.ObservableInputStream(InputStream, Observer...).
</action>
+ <action dev="ggregory" type="add" due-to="Gary Gregory">
+ Make ObservableInputStream.getObservers() public.
+ </action>
<!-- UPDATES -->
<action dev="ggregory" type="update" due-to="Dependabot">
Update junit-jupiter from 5.6.2 to 5.7.0 #153.

MODIFY
src/main/java/org/apache/commons/io/input/ObservableInputStream.java
src/main/java/org/apache/commons/io/input/ObservableInputStream.java
@@ -174,8 +174,9 @@ public void consume() throws IOException {
* Gets all currently registered observers.
*
* @return a list of the currently registered observers
+ * @since 2.9.0
*/
- protected List<Observer> getObservers() {
+ public List<Observer> getObservers() {
return observers;
}

MODIFY
src/test/java/org/apache/commons/io/input/ObservableInputStreamTest.java
src/test/java/org/apache/commons/io/input/ObservableInputStreamTest.java
package org.apache.commons.io.input;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
@@ -171,11 +171,9 @@ public void testDataBytesCalled() throws Exception {
}
@Test
- public void testTimestamped() {
- final byte[] buffer = MessageDigestCalculatingInputStreamTest
- .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE);
- final ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
- final ObservableInputStream ois = new ObservableInputStream(bais);
-
+ public void testGetObservers() {
+ final LastBytesKeepingObserver observer = new LastBytesKeepingObserver();
+ final ObservableInputStream ois = new ObservableInputStream(new NullInputStream(), observer);
+ assertEquals(observer, ois.getObservers().get(0));
}
}

Make ObservableInputStream.getObservers() public.