public static void assertFieldInDocumentSerialization(TestDocumentFactory documentFactory, String fieldName,
                                                          FieldValue serializableFieldValue) {
        Document document = documentFactory.createDocument();
        document.setFieldValue(fieldName, serializableFieldValue);
        byte[] buf = serializeDocument(document);
        Document deserializedDocument = deserializeDocument(buf, documentFactory);
        assertEquals(document, deserializedDocument);
        assertEquals(serializableFieldValue, deserializedDocument.getFieldValue(fieldName));
    }
Helper class with utils used in serialization and deserialization test cases.

@author geirst
document/src/test/java/com/yahoo/document/serialization/SerializationTestUtils.java