use of tests.support.Support_StringReader in project robovm by robovm.
the class OldStreamTokenizerTest method test_nextToken.
public void test_nextToken() throws IOException {
st = new StreamTokenizer(new Support_StringReader("\n \r\n#"));
// make \n ordinary
st.ordinaryChar('\n');
st.eolIsSignificant(true);
assertTrue("Wrong token 2,1", st.nextToken() == '\n');
assertTrue("Wrong token 2,2", st.nextToken() == '\n');
assertEquals("Wrong token 2,3", '#', st.nextToken());
Support_ASimpleInputStream sis = new Support_ASimpleInputStream();
sis.throwExceptionOnNextUse = true;
st = new StreamTokenizer(sis);
try {
st.nextToken();
fail("IOException expected.");
} catch (IOException e) {
// Expected.
}
}
use of tests.support.Support_StringReader in project robovm by robovm.
the class OldBufferedReaderTest method test_ConstructorLjava_io_ReaderI.
public void test_ConstructorLjava_io_ReaderI() {
// Illegal negative size argument test.
try {
br = new BufferedReader(new Support_StringReader(testString), 0);
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException expected) {
}
br = new BufferedReader(new Support_StringReader(testString), 1024);
assertNotNull(br);
}
use of tests.support.Support_StringReader in project robovm by robovm.
the class OldBufferedReaderTest method test_close.
public void test_close() {
Support_ASimpleReader ssr = new Support_ASimpleReader(true);
try {
br = new BufferedReader(new Support_StringReader(testString));
br.close();
br.read();
fail("Test 1: Read on closed stream.");
} catch (IOException x) {
// Expected.
} catch (Exception e) {
fail("Exception during close test " + e.toString());
}
br = new BufferedReader(ssr);
try {
br.close();
fail("Test 2: IOException expected.");
} catch (IOException e) {
// Expected.
}
// Avoid IOException in tearDown().
ssr.throwExceptionOnNextUse = false;
}
use of tests.support.Support_StringReader in project robovm by robovm.
the class OldBufferedReaderTest method test_read$CII_Exception.
public void test_read$CII_Exception() throws Exception {
br = new BufferedReader(new Support_StringReader(testString));
try {
br.read(new char[10], -1, 1);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// Expected
}
try {
br.read(new char[10], 0, -1);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// Expected
}
try {
br.read(new char[10], 10, 1);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// Expected
}
//regression for HARMONY-831
try {
new BufferedReader(new PipedReader(), 9).read(new char[] {}, 7, 0);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
}
}
use of tests.support.Support_StringReader in project robovm by robovm.
the class OldBufferedReaderTest method test_ConstructorLjava_io_Reader.
public void test_ConstructorLjava_io_Reader() {
// Test for method java.io.BufferedReader(java.io.Reader)
br = new BufferedReader(new Support_StringReader(testString));
assertNotNull(br);
}
Aggregations