| Method from org.apache.commons.collections.primitives.adapters.io.TestInputStreamByteIterator Detail: |
protected byte[] getFullElements() {
byte[] bytes = new byte[256];
for(int i=0; i < 256; i++) {
bytes[i] = (byte)(i-128);
}
return bytes;
}
|
protected ByteIterator makeEmptyByteIterator() {
return new InputStreamByteIterator(new ByteArrayInputStream(new byte[0]));
}
|
protected ByteIterator makeFullByteIterator() {
return new InputStreamByteIterator(new ByteArrayInputStream(getFullElements()));
}
|
public static Test suite() {
return new TestSuite(TestInputStreamByteIterator.class);
}
|
public boolean supportsRemove() {
return false;
}
|
public void testAdaptNonNull() {
assertNotNull(InputStreamByteIterator.adapt(new ByteArrayInputStream(new byte[0])));
}
|
public void testAdaptNull() {
assertNull(InputStreamByteIterator.adapt(null));
}
|
public void testErrorThrowingStream() {
InputStream errStream = new InputStream() {
public int read() throws IOException {
throw new IOException();
}
};
ByteIterator iter = new InputStreamByteIterator(errStream);
try {
iter.hasNext();
fail("Expected RuntimeException");
} catch(RuntimeException e) {
// expected
}
try {
iter.next();
fail("Expected RuntimeException");
} catch(RuntimeException e) {
// expected
}
}
|