// create property, prepare the data to be readed
String pname = "file@" + testFile.getName();
Property p = testRoot.setProperty(pname, new FileInputStream(testFile));
EditableBinaryValue exv = (EditableBinaryValue)p.getValue();
String update1String = "update#1";
long pos = 1024 * 1024;
exv.update(new ByteArrayInputStream(update1String.getBytes()), update1String.length(), pos);
p.setValue(exv);
testRoot.save();
// read partial
exv = (EditableBinaryValue)testRoot.getProperty(pname).getValue();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
long res = exv.read(baos, 5, pos + 2); // read 'date#' bytes
String expected = update1String.substring(2, 7);
assertEquals(expected.length() + " bytes must be read", expected.length(), res);
assertEquals("Readed content not equals to expected", expected, new String(baos.toByteArray()));
// next read
baos = new ByteArrayOutputStream();
res = exv.read(baos, 3, pos + 1); // read 'pda' bytes
expected = update1String.substring(1, 4);
assertEquals(expected.length() + " bytes must be read", expected.length(), res);