#687 #691 Stream performance regressions... and JDK 17+ support :-P

This commit is contained in:
Harald Kuhr 2022-10-14 18:20:47 +02:00
parent c01336fb8a
commit 2500d8cc15

View File

@ -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);