@Test
public void testRelease()
{
TestLazySliceArrayBlockLoader loader = new TestLazySliceArrayBlockLoader(null);
LazySliceArrayBlock block = new LazySliceArrayBlock(10, loader);
// release the block
block.release();
// verify release was called
assertTrue(loader.released);
// verify methods accessing the data throw IllegalStateException
try {
block.isNull(0);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
try {
block.getLength(0);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
try {
block.getByte(0, 0);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
try {
block.getInt(0, 0);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
try {
block.getLong(0, 0);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
try {
block.getDouble(0, 0);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
try {
block.getSlice(0, 0, 1);
fail("Expected IllegalStateException");
}
catch (IllegalStateException expected) {
}
}