private void serializeAndAssert(Annotation annotation) {
        GrowableByteBuffer buffer = new GrowableByteBuffer(1024);
        DocumentSerializer serializer = DocumentSerializerFactory.createHead(buffer);
        serializer.write(annotation);
        buffer.flip();

        DocumentDeserializer deserializer = DocumentDeserializerFactory.createHead(man, buffer);
        Annotation annotation2 = new Annotation();
        deserializer.read(annotation2);

        assertEquals(annotation, annotation2);
        assertNotSame(annotation, annotation2);
    }
A test case taken from real use to verify the API ease of use
document/src/test/java/com/yahoo/document/annotation/AnnotationTestCase.java