|
17 | 17 | package org.apache.commons.io.input; |
18 | 18 |
|
19 | 19 | import static org.junit.jupiter.api.Assertions.assertEquals; |
20 | | -import static org.junit.jupiter.api.Assertions.assertNotEquals; |
21 | 20 | import static org.junit.jupiter.api.Assertions.assertFalse; |
| 21 | +import static org.junit.jupiter.api.Assertions.assertNotEquals; |
22 | 22 | import static org.junit.jupiter.api.Assertions.assertTrue; |
23 | 23 |
|
24 | 24 | import java.io.ByteArrayInputStream; |
@@ -74,7 +74,7 @@ public void data(final byte[] pBuffer, final int pOffset, final int pLength) thr |
74 | 74 | @Test |
75 | 75 | public void testDataByteCalled_add() throws Exception { |
76 | 76 | final byte[] buffer = MessageDigestCalculatingInputStreamTest |
77 | | - .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
| 77 | + .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
78 | 78 | final LastByteKeepingObserver lko = new LastByteKeepingObserver(); |
79 | 79 | try (final ObservableInputStream ois = new ObservableInputStream(new ByteArrayInputStream(buffer))) { |
80 | 80 | assertEquals(-1, lko.lastByteSeen); |
@@ -106,7 +106,7 @@ public void testDataByteCalled_add() throws Exception { |
106 | 106 | @Test |
107 | 107 | public void testDataByteCalled_ctor() throws Exception { |
108 | 108 | final byte[] buffer = MessageDigestCalculatingInputStreamTest |
109 | | - .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
| 109 | + .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
110 | 110 | final LastByteKeepingObserver lko = new LastByteKeepingObserver(); |
111 | 111 | try (final ObservableInputStream ois = new ObservableInputStream(new ByteArrayInputStream(buffer), lko)) { |
112 | 112 | assertEquals(-1, lko.lastByteSeen); |
@@ -137,7 +137,7 @@ public void testDataByteCalled_ctor() throws Exception { |
137 | 137 | @Test |
138 | 138 | public void testDataBytesCalled() throws Exception { |
139 | 139 | final byte[] buffer = MessageDigestCalculatingInputStreamTest |
140 | | - .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
| 140 | + .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
141 | 141 | final ByteArrayInputStream bais = new ByteArrayInputStream(buffer); |
142 | 142 | final ObservableInputStream ois = new ObservableInputStream(bais); |
143 | 143 | final LastBytesKeepingObserver lko = new LastBytesKeepingObserver(); |
@@ -171,11 +171,9 @@ public void testDataBytesCalled() throws Exception { |
171 | 171 | } |
172 | 172 |
|
173 | 173 | @Test |
174 | | - public void testTimestamped() { |
175 | | - final byte[] buffer = MessageDigestCalculatingInputStreamTest |
176 | | - .generateRandomByteStream(IOUtils.DEFAULT_BUFFER_SIZE); |
177 | | - final ByteArrayInputStream bais = new ByteArrayInputStream(buffer); |
178 | | - final ObservableInputStream ois = new ObservableInputStream(bais); |
179 | | - |
| 174 | + public void testGetObservers() { |
| 175 | + final LastBytesKeepingObserver observer = new LastBytesKeepingObserver(); |
| 176 | + final ObservableInputStream ois = new ObservableInputStream(new NullInputStream(), observer); |
| 177 | + assertEquals(observer, ois.getObservers().get(0)); |
180 | 178 | } |
181 | 179 | } |
0 commit comments