ObjectIOClassNotFoundException, BinaryConverterException,
ObjectIOTooBigForSerializationException {
/* initial write */
BobSerializable.defaultWrite = true;
final BobSerializable bob = new BobSerializable();
Integer firstField = Integer.valueOf(1);
bob.setObject(firstField);// first field
bob.setValue(1);// second field
bob.setBoolean1(Boolean.TRUE);// third field
final ObjectAndPersistInfo objectAndItsPersistInfo = createObjectAndItsPersistInfo(bob);
WriteResult writeResult = write(objectAndItsPersistInfo);
assertValueChangeForFirstWrite(writeResult);
assertType(new int[] { HelperBinaryConversion.REFERENCE_TYPE,
HelperBinaryConversion.INTEGER_TYPE,
HelperBinaryConversion.BOOLEAN_TYPE }, writeResult);
assertReferencedSons(new Class[] { Object.class },
new Class[] { Integer.class }, new Object[] { firstField },
writeResult);
assertReferenceChange(objectAndItsPersistInfo, new Class[] { null },
new Class[] { Integer.class }, writeResult);
assertOriginalValue(new Object[] { firstField /* ,1,Boolean.TRUE */},
objectAndItsPersistInfo);
assertWriteInformationCleared(objectAndItsPersistInfo);
/* second write, no state change */
writeResult = write(objectAndItsPersistInfo);
assertValueChangeForSameStateWrite(writeResult);
assertWriteInformationCleared(objectAndItsPersistInfo);
/* third write */
firstField = Integer.valueOf(2);
bob.setObject(firstField);// change first field
final Boolean thirdField = Boolean.FALSE;
bob.setBoolean1(thirdField);// change third field
writeResult = write(objectAndItsPersistInfo);
assertValueChangeSinceStateChange(writeResult);
assertReferencedSons(new Class[] { Object.class /* , Boolean.class */},
new Class[] { Integer.class /* , Boolean.class */},
new Object[] { firstField /* , thirdField */}, writeResult);
assertReferenceChange(objectAndItsPersistInfo, new Class[] {
Integer.class, null }, new Class[] { null, Integer.class },
writeResult);
// assertOriginalValueNotDefined(objectAndItsPersistInfo);
assertOriginalValue(new Object[] { firstField },
objectAndItsPersistInfo);
assertWriteInformationCleared(objectAndItsPersistInfo);
/* fourth write */
bob.setValue(2);// change second field
writeResult = write(objectAndItsPersistInfo);
assertValueChangeSinceStateChange(writeResult);
assertReferencedSons(new Class[] { Object.class },
new Class[] { Integer.class }, new Object[] { firstField },
writeResult);