use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.
the class SerialBlobTests method test20.
/*
* Validate that a SerialBlob that is serialized & deserialized is equal to
* itself
*/
@Test
public void test20() throws Exception {
SerialBlob sb = new SerialBlob(bytes);
SerialBlob sb2 = serializeDeserializeObject(sb);
assertTrue(sb.equals(sb2), "SerialBlob not equal");
}
use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.
the class SerialBlobTests method test.
/*
* Validate calling free() does not throw an Exception
*/
@Test
public void test() throws Exception {
SerialBlob sb = new SerialBlob(new StubBlob());
sb.free();
}
use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.
the class SerialBlobTests method test29.
/*
* Validate that position returns the correct starting location for a
* pattern in the SerialBlob
*/
@Test
public void test29() throws Exception {
// starting offset is 1 vs 0
long expectedPos = 2;
byte[] pattern = new byte[] { 4, 6 };
SerialBlob sb = new SerialBlob(new StubBlob());
long pos = sb.position(pattern, 1);
assertEquals(pos, expectedPos);
}
use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.
the class SerialBlobTests method test18.
/*
* Validate that a cloned SerializedBlob bytes match the original
*/
@Test
public void test18() throws Exception {
SerialBlob sb = new SerialBlob(bytes);
SerialBlob sb2 = (SerialBlob) sb.clone();
assertTrue(Arrays.equals(sb.getBytes(1, (int) sb.length()), sb2.getBytes(1, (int) sb2.length())), "arrays do not match ");
}
use of javax.sql.rowset.serial.SerialBlob in project jdk8u_jdk by JetBrains.
the class SerialBlobTests method test19.
/*
* Test clone after free has been called that the clone is not accessible
*/
@Test(expectedExceptions = SerialException.class)
public void test19() throws Exception {
SerialBlob sb = new SerialBlob(bytes);
sb.free();
SerialBlob sb2 = (SerialBlob) sb.clone();
InputStream is = sb2.getBinaryStream(1, 3);
}
Aggregations