@Test
public void basicSerializationCycle() {
/// First we create a state engine, we need to tell it about our data model by
/// passing it a serializer factory which creates our top-level serializers.
stateEngine = new FastBlobStateEngine(new ExampleSerializerFactory());
/// For this example, we're just storing the serialized data in memory.
byte snapshot[] = createSnapshot();
byte delta[] = createDelta();
/// Now we can pretend to be the client, and deserialize the data into a separate state engine.
FastBlobStateEngine clientStateEngine = deserializeLatestData(snapshot, delta);
/// We can grab the data for any class. Here, we grab the values for class A.
FastBlobTypeDeserializationState<A> aState = clientStateEngine.getTypeDeserializationState("A");
/// the following will loop through all values after loading the snapshot
/// and subsequently applying the delta. It will print out "1" followed by "3".
System.out.println("All As: ");
for(A deserializedA : aState){
System.out.println(deserializedA.getIntValue());
}
/// As another example, we can grab the values for class B.
FastBlobTypeDeserializationState<B> bState = clientStateEngine.getTypeDeserializationState("B");
/// Even though we didn't directly add the Bs, they were added because we added objects which
/// referenced them. Here, we iterate over all of the Bs after applying the delta.
/// This will print out "1", "2", "3", "4", "6"
System.out.println("All Bs: ");