assertTrue(Arrays.equals(mockClob.buf, data));
assertFalse(reader.ready());
}
public void testGetSubString() throws Exception {
SerialClob serialClob = new SerialClob("hello".toCharArray());
String sub = serialClob.getSubString(1, 5);
assertEquals("hello", sub);
sub = serialClob.getSubString(2, 3);
assertEquals("ell", sub);
try {
sub = serialClob.getSubString(0, 6);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
try {
sub = serialClob.getSubString(7, 1);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
try {
sub = serialClob.getSubString(1, 7);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
try {
sub = serialClob.getSubString(1, -2);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
try {
sub = serialClob.getSubString(3, 4);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}
LongLengthClob longClob = new LongLengthClob();
serialClob = new SerialClob(longClob);
try {
serialClob.getSubString(1, 3);
fail("should throw SerialException");
} catch (SerialException e) {
// expected
}