mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-03 11:35:29 -04:00
parent
c01336fb8a
commit
2500d8cc15
@ -46,7 +46,9 @@ import java.util.Random;
|
|||||||
|
|
||||||
import static com.twelvemonkeys.imageio.stream.BufferedImageInputStreamTest.rangeEquals;
|
import static com.twelvemonkeys.imageio.stream.BufferedImageInputStreamTest.rangeEquals;
|
||||||
import static org.junit.Assert.*;
|
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
|
* 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
|
@Test
|
||||||
public void testCloseChannel() throws IOException {
|
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);
|
SeekableByteChannel mock = mock(SeekableByteChannel.class);
|
||||||
ImageInputStream stream = new BufferedChannelImageInputStream(mock);
|
ImageInputStream stream = new BufferedChannelImageInputStream(mock);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user