use of tests.support.Support_ASimpleInputStream in project robovm by robovm.
the class Test method test_skipBytesI_IOException.
public void test_skipBytesI_IOException() throws IOException {
oos.writeObject(testString);
oos.close();
Support_ASimpleInputStream sis = new Support_ASimpleInputStream(bao.toByteArray());
ois = new ObjectInputStream(sis);
sis.throwExceptionOnNextUse = true;
try {
ois.skipBytes(5);
fail("Test 1: IOException expected.");
} catch (IOException e) {
// Expected.
}
sis.throwExceptionOnNextUse = false;
ois.close();
}
use of tests.support.Support_ASimpleInputStream in project robovm by robovm.
the class Test method test_read$BII_Exception.
public void test_read$BII_Exception() throws IOException {
byte[] buf = new byte[testLength];
oos.writeObject(testString);
oos.close();
ois = new ObjectInputStream(new ByteArrayInputStream(bao.toByteArray()));
try {
ois.read(buf, 0, -1);
fail("IndexOutOfBoundsException was not thrown.");
} catch (IndexOutOfBoundsException e) {
// Expected
}
try {
ois.read(buf, -1, 1);
fail("IndexOutOfBoundsException was not thrown.");
} catch (IndexOutOfBoundsException e) {
// Expected
}
try {
ois.read(buf, testLength, 1);
fail("IndexOutOfBoundsException was not thrown.");
} catch (IndexOutOfBoundsException e) {
// Expected
}
ois.close();
Support_ASimpleInputStream sis = new Support_ASimpleInputStream(bao.toByteArray());
ois = new ObjectInputStream(sis);
sis.throwExceptionOnNextUse = true;
try {
ois.read(buf, 0, testLength);
fail("Test 1: IOException expected.");
} catch (IOException e) {
// Expected.
}
sis.throwExceptionOnNextUse = false;
ois.close();
}
use of tests.support.Support_ASimpleInputStream in project robovm by robovm.
the class Test method test_available_IOException.
public void test_available_IOException() throws IOException {
oos.writeObject(testString);
oos.close();
Support_ASimpleInputStream sis = new Support_ASimpleInputStream(bao.toByteArray());
ois = new ObjectInputStream(sis);
sis.throwExceptionOnNextUse = true;
try {
ois.available();
fail("Test 1: IOException expected.");
} catch (IOException e) {
// Expected.
}
sis.throwExceptionOnNextUse = false;
ois.close();
}
use of tests.support.Support_ASimpleInputStream in project robovm by robovm.
the class Test method test_readFully$B_Exception.
public void test_readFully$B_Exception() throws IOException {
byte[] buf = new byte[testLength];
oos.writeObject(testString);
oos.close();
Support_ASimpleInputStream sis = new Support_ASimpleInputStream(bao.toByteArray());
ois = new ObjectInputStream(sis);
sis.throwExceptionOnNextUse = true;
try {
ois.readFully(buf);
fail("Test 1: IOException expected.");
} catch (IOException e) {
// Expected.
}
sis.throwExceptionOnNextUse = false;
ois.close();
}
use of tests.support.Support_ASimpleInputStream in project j2objc by google.
the class OldFilterInputStreamTest method test_close.
public void test_close() throws IOException {
is.close();
try {
is.read();
fail("Test 1: Read from closed stream succeeded.");
} catch (IOException e) {
// Expected.
}
Support_ASimpleInputStream sis = new Support_ASimpleInputStream(true);
is = new MyFilterInputStream(sis);
try {
is.close();
fail("Test 2: IOException expected.");
} catch (IOException e) {
// Expected.
}
sis.throwExceptionOnNextUse = false;
}
Aggregations