final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(toSerialize.getClass());
Object[] referenceds = toSerializeAndReferenced.getReferenceds();
// initial write
WriteResult writeResult = write(toSerialize, classInfo);
ObjectClassInfoAndDeclared[] sons = writeResult.getSons();
ObjectAndPersistInfo objectAndPersistInfo = writeResult
.getObjectAndPersistInfo();
final byte[] binary = writeResult.getBinary();
// check sons wrote
assertSons(toSerialize, sons, referenceds);
ObjectClassInfoAndDeclared[] originalValue = objectAndPersistInfo.originalValue;
assertSons(toSerialize, originalValue, referenceds);
// dummy data record identifier for object
final DataRecordIdentifier dataRecordIdentifier =
/**/getOrCreateDataRecordIdentifierAssociatedToObject(objectAndPersistInfo);
// create the object by reading
final IObjectInput objectInput = new ObjectInputImmediateSerializable(
this, classInfoFactory, proxyManager2, helperBinaryConversion);
final StorageInfo storageInfo = new StorageInfo();
// storageInfo.setHeaderDataSize(0);
ObjectAndPersistInfo unserializedAndPersistInfo = objectInput
.createObject(dataRecordIdentifier, binary, classInfo,
storageInfo);
originalValue = unserializedAndPersistInfo.originalValue;
assertSons(toSerialize, originalValue, referenceds);
final Object unserialized = unserializedAndPersistInfo.getObject();
if (testEquals) {
assertEquals("read and wrote must have the same value",
toSerialize, unserialized);
}
assertUnserialized(unserialized);
// check modification
referenceds = modifyObjectToSerialize(unserialized);
// write
writeResult = write(unserialized, classInfo);
sons = writeResult.getSons();
unserializedAndPersistInfo = writeResult.getObjectAndPersistInfo();
// check sons wrote
assertSons(toSerialize, sons, referenceds);
originalValue = unserializedAndPersistInfo.originalValue;
assertSons(toSerialize, originalValue, referenceds);
// modify wrote object
referenceds = modifyObjectToSerialize(toSerialize);
// write modification
writeResult = write(toSerialize, classInfo);
sons = writeResult.getSons();
objectAndPersistInfo = writeResult.getObjectAndPersistInfo();
// check sons wrote
assertSons(toSerialize, sons, referenceds);
originalValue = objectAndPersistInfo.originalValue;
assertSons(toSerialize, originalValue, referenceds);