Test serialization and deserialization of classes