use of java.io.PushbackReader in project robovm by robovm.
the class OldPushbackReaderTest method test_unread$CII.
/**
* java.io.PushbackReader#unread(char[], int, int)
*/
public void test_unread$CII() throws IOException {
PushbackReader tobj;
String str2 = "0123456789";
char[] buf2 = (str2 + str2 + str2).toCharArray();
char[] readBuf = new char[10];
tobj = new PushbackReader(underlying, 10);
tobj.unread(buf2, 15, 10);
try {
tobj.unread(buf2, 15, 10);
fail("IOException not thrown.");
} catch (IOException e) {
// expected
}
tobj.read(readBuf);
assertEquals("Incorrect bytes read", "5678901234", new String(readBuf));
underlying.throwExceptionOnNextUse = true;
try {
tobj.read(buf2, 15, 10);
fail("IOException not thrown.");
} catch (IOException e) {
// expected
}
}
use of java.io.PushbackReader in project robovm by robovm.
the class OldPushbackReaderTest method test_unread_$CII_ArrayIndexOutOfBoundsException.
public void test_unread_$CII_ArrayIndexOutOfBoundsException() throws IOException {
//a pushback reader with one character buffer
pbr = new PushbackReader(new StringReader(pbString));
try {
pbr.unread(new char[pbString.length()], 0, -1);
fail("should throw ArrayIndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
pbr.unread(new char[10], 10, 1);
fail("should throw ArrayIndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
}
use of java.io.PushbackReader in project robovm by robovm.
the class OldPushbackReaderTest method test_skip$J.
/**
* @throws IOException
* java.io.PushbackReader#skip(long)
*/
public void test_skip$J() throws IOException {
PushbackReader tobj;
tobj = new PushbackReader(underlying);
tobj.skip(6);
tobj.skip(1000000);
tobj.skip(1000000);
underlying.throwExceptionOnNextUse = true;
try {
tobj.skip(1);
fail("IOException not thrown.");
} catch (IOException e) {
// expected
}
}
use of java.io.PushbackReader in project robovm by robovm.
the class OldPushbackReaderTest method test_ready.
/**
* java.io.PushbackReader#ready()
*/
public void test_ready() throws IOException {
PushbackReader tobj;
tobj = new PushbackReader(underlying);
assertTrue("Should be ready!", tobj.ready());
underlying.throwExceptionOnNextUse = true;
try {
tobj.ready();
fail("IOException not thrown.");
} catch (IOException e) {
// expected
}
}
use of java.io.PushbackReader in project robovm by robovm.
the class OldPushbackReaderTest method test_read.
/**
* java.io.PushbackReader#read()
*/
public void test_read() throws IOException {
PushbackReader tobj;
tobj = new PushbackReader(underlying);
assertEquals("Wrong value read!", 66, tobj.read());
underlying.throwExceptionOnNextUse = true;
try {
tobj.read();
fail("IOException not thrown.");
} catch (IOException e) {
// expected
}
}
Aggregations