FilePersistenceNotSerializableException,
FilePersistenceTooBigForSerializationException {
filePersistence.addToNotCheckMethod(Bob1.class);
final Object keptInMemoryObject = new Object();
filePersistence.keptInMemory("object", keptInMemoryObject);
final IDataAccessSession dataAccessSession = filePersistence
.createDataAccessSession();
BobContainer bobContainer1 = new BobContainer();
bobContainer1.setObject1(keptInMemoryObject);
final Bob1 bob1 = new Bob1();
bob1.setVal(10);
bobContainer1.setObject2(bob1);
BobContainer bobContainer2 = new BobContainer();
bobContainer2.setObject1(keptInMemoryObject);
dataAccessSession.open();
dataAccessSession.setObject(KEY1, bobContainer1);
dataAccessSession.setObject(KEY2, bobContainer2);
dataAccessSession.close(EnumFilePersistenceCloseAction.SAVE);
dataAccessSession.open();
bobContainer1 = (BobContainer) dataAccessSession.getObject(KEY1);
assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
bobContainer1.getObject1());
final Bob1 bob1Read = (Bob1) bobContainer1.getObject2();
assertNotSame("must no be same object", bob1, bob1Read);
bobContainer2 = (BobContainer) dataAccessSession.getObject(KEY2);
assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
bobContainer2.getObject1());
}