From 2500d8cc15da5aac345a0f5cf802ebe3c3d2ade6 Mon Sep 17 00:00:00 2001 From: Harald Kuhr Date: Fri, 14 Oct 2022 18:20:47 +0200 Subject: [PATCH] #687 #691 Stream performance regressions... and JDK 17+ support :-P --- .../BufferedChannelImageInputStreamTest.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/imageio/imageio-core/src/test/java/com/twelvemonkeys/imageio/stream/BufferedChannelImageInputStreamTest.java b/imageio/imageio-core/src/test/java/com/twelvemonkeys/imageio/stream/BufferedChannelImageInputStreamTest.java index 579f13e6..417e0ce4 100755 --- a/imageio/imageio-core/src/test/java/com/twelvemonkeys/imageio/stream/BufferedChannelImageInputStreamTest.java +++ b/imageio/imageio-core/src/test/java/com/twelvemonkeys/imageio/stream/BufferedChannelImageInputStreamTest.java @@ -46,7 +46,9 @@ import java.util.Random; import static com.twelvemonkeys.imageio.stream.BufferedImageInputStreamTest.rangeEquals; import static org.junit.Assert.*; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.only; +import static org.mockito.Mockito.verify; /** * BufferedFileImageInputStreamTestCase @@ -399,19 +401,11 @@ public class BufferedChannelImageInputStreamTest { } } - @Test - public void testCloseStream() throws IOException { - // Create wrapper stream - FileInputStream input = spy(new FileInputStream(randomDataToFile(new byte[0]))); - ImageInputStream stream = new BufferedChannelImageInputStream(input); - reset(input); - - stream.close(); - verify(input, only()).close(); - } - @Test public void testCloseChannel() throws IOException { + // NOTE: As the stream-based constructor is chained to the channel-based one, + // we'll rely on the fact that closing the channel will close the stream. + SeekableByteChannel mock = mock(SeekableByteChannel.class); ImageInputStream stream = new BufferedChannelImageInputStream(mock);