Skip to content

Commit 8fb3ee7

Browse files
committed
Add tests
1 parent f115b10 commit 8fb3ee7

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/test/java/org/apache/commons/io/input/ProxyInputStreamTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,17 @@ void testReadEof() throws Exception {
327327
}
328328
}
329329

330+
@Test
331+
void testSetReference() throws Exception {
332+
final ByteArrayInputStream first = new ByteArrayInputStream(new byte[2]);
333+
try (ProxyInputStream wrapped = new ProxyInputStreamFixture(first)) {
334+
assertSame(first, wrapped.unwrap());
335+
final NullInputStream in = new NullInputStream();
336+
wrapped.setReference(in);
337+
assertSame(in, wrapped.unwrap());
338+
}
339+
}
340+
330341
@Test
331342
void testSubclassAfterReadConsumer() throws Exception {
332343
final byte[] hello = "Hello".getBytes(StandardCharsets.UTF_8);
@@ -355,4 +366,12 @@ void testSubclassAfterReadConsumer() throws Exception {
355366
// @formatter:on
356367
}
357368

369+
@Test
370+
void testUnwrap() throws Exception {
371+
final ByteArrayInputStream first = new ByteArrayInputStream(new byte[2]);
372+
try (ProxyInputStream wrapped = new ProxyInputStreamFixture(first)) {
373+
assertSame(first, wrapped.unwrap());
374+
}
375+
}
376+
358377
}

0 commit comments

Comments
 (0)