*/
public class MongoDBQueryDescriptorSerializationTest {
@Test
public void canSerializeAndDeserialize() throws Exception {
MongoDBQueryDescriptor descriptor = new MongoDBQueryDescriptor(
"test",
Operation.FIND,
new BasicDBObject( "foo", "bar" ),
new BasicDBObject( "foo", 1 ),
new BasicDBObject( "bar", 1 )
);
byte[] bytes = serialize( descriptor );
MongoDBQueryDescriptor deserializedDescriptor = deserialize( bytes );
assertThat( deserializedDescriptor.getCollectionName() ).isEqualTo( descriptor.getCollectionName() );
assertThat( deserializedDescriptor.getOperation() ).isEqualTo( descriptor.getOperation() );
assertThat( deserializedDescriptor.getCriteria() ).isEqualTo( descriptor.getCriteria() );
assertThat( deserializedDescriptor.getProjection() ).isEqualTo( descriptor.getProjection() );
assertThat( deserializedDescriptor.getOrderBy() ).isEqualTo( descriptor.getOrderBy() );
}