private void testReadBlob(boolean close) throws Exception { byte[] result = null; String data = "LZW"; when(blob.getBinaryStream()).thenReturn(new ByteArrayInputStream(data.getBytes())); if (close == true) { result = TypeHandlerUtils.readBlob(blob); } else { result = TypeHandlerUtils.readBlob(blob, false); } Assert.assertEquals(data, new String(result)); }