use of java.io.CharArrayReader in project robovm by robovm.
the class OldCharArrayReaderTest method test_markI.
/**
* java.io.CharArrayReader#mark(int)
*/
public void test_markI() throws IOException {
cr = new CharArrayReader(hw);
cr.skip(5L);
cr.mark(100);
cr.read();
cr.reset();
assertEquals("Test 1: Failed to mark correct position;", 'W', cr.read());
cr.close();
try {
cr.mark(100);
fail("Test 2: IOException expected.");
} catch (IOException e) {
// Expected.
}
}
use of java.io.CharArrayReader in project robovm by robovm.
the class OldCharArrayReaderTest method test_read$CII.
/**
* java.io.CharArrayReader#read(char[], int, int)
*/
public void test_read$CII() throws IOException {
// Test for method int java.io.CharArrayReader.read(char [], int, int)
char[] c = new char[11];
cr = new CharArrayReader(hw);
cr.read(c, 1, 10);
assertTrue("Test 1: Read returned incorrect chars.", new String(c, 1, 10).equals(new String(hw, 0, 10)));
// Illegal argument checks.
try {
cr.read(null, 1, 0);
fail("Test 2: NullPointerException expected.");
} catch (NullPointerException e) {
// Expected.
}
try {
cr.read(c, -1, 1);
fail("Test 3: ArrayIndexOutOfBoundsException expected.");
} catch (IndexOutOfBoundsException e) {
// Expected
}
try {
cr.read(c, 1, -1);
fail("Test 4: ArrayIndexOutOfBoundsException expected.");
} catch (IndexOutOfBoundsException e) {
// Expected
}
try {
cr.read(c, 1, c.length);
fail("Test 5: ArrayIndexOutOfBoundsException expected.");
} catch (IndexOutOfBoundsException e) {
// Expected
}
cr.close();
try {
cr.read(c, 1, 1);
fail("Test 6: IOException expected.");
} catch (IOException e) {
// Expected.
}
}
use of java.io.CharArrayReader in project robovm by robovm.
the class OldAndroidCharArrayReaderTest method testCharArrayReader.
public void testCharArrayReader() throws Exception {
String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
CharArrayReader a = new CharArrayReader(str.toCharArray());
CharArrayReader b = new CharArrayReader(str.toCharArray());
CharArrayReader c = new CharArrayReader(str.toCharArray());
CharArrayReader d = new CharArrayReader(str.toCharArray());
Assert.assertEquals(str, read(a));
Assert.assertEquals("AbCdEfGhIj", read(b, 10));
Assert.assertEquals("bdfhjlnprtvxz", skipRead(c));
Assert.assertEquals("AbCdEfGdEfGhIjKlMnOpQrStUvWxYz", markRead(d, 3, 4));
}
use of java.io.CharArrayReader in project j2objc by google.
the class OldCharArrayReaderTest method test_close.
/**
* java.io.CharArrayReader#close()
*/
public void test_close() {
cr = new CharArrayReader(hw);
cr.close();
try {
cr.read();
fail("Failed to throw exception on read from closed stream");
} catch (IOException e) {
// Expected.
}
}
use of java.io.CharArrayReader in project j2objc by google.
the class OldCharArrayReaderTest method test_Constructor$C.
/**
* java.io.CharArrayReader#CharArrayReader(char[])
*/
public void test_Constructor$C() {
try {
cr = new CharArrayReader(hw);
assertTrue("Failed to create reader", cr.ready());
} catch (IOException e) {
fail("Exception determining ready state : " + e.getMessage());
}
}
Aggregations