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);
}
use of tests.support.Support_StringReader in project j2objc by google.
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) {
}
}
Aggregations