@Test
    public void testSerializeSimpleTree() throws IOException {
        SpanList root = new SpanList();
        root.add(new Span(0, 19))
            .add(new Span(19, 5))
            .add(new Span(24, 21))
            .add(new Span(45, 23))
            .add(new Span(68, 14));
        SpanTree tree = new SpanTree("html", root);
        StringFieldValue value = new StringFieldValue("lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj " +
                                                      "lkj lkj lkj lkj lkj lkj lkj lkj lkj lkj l jlkj lkj lkj " +
                                                      "lkjoijoij oij oij oij oij oij oijoijoij oij oij oij oij oij " +
                                                      "oijoijoijoijoijoijoijoijoijoijoijoijoij oij oij oij oij " +
                                                      "oijaosdifjoai fdoais jdoasi jai os oafoai ai dfojsfoa dfoi dsf" +
                                                      "aosifjasofija sodfij oasdifj aosdiosifjsi ooai oais osi");
        value.setSpanTree(tree);

        /*
        Important note! The iteration order of annotations in SpanTree.iterator() is non-deterministic, meaning
        that the order which annotations are serialized will differ between test runs. Thus, we cannot assert
        that a serialized buffer is equal to a buffer written earlier. We can, however, assert that the size stays
        the same, and the deserialized values from the buffers should be equal.
         */

        //important! call readFile() before writeFile()!
        ByteBuffer serializedFromFile = readFile("test_data_serialized_simple");
        ByteBuffer serialized = writeFile(value, "test_data_serialized_simple");
        assertEquals(serialized.limit(), serializedFromFile.limit());

        StringFieldValue valueFromFile = new StringFieldValue();
        DocumentDeserializer deserializer = DocumentDeserializerFactory.createHead(docMan, new GrowableByteBuffer(serializedFromFile));
        deserializer.read(null, valueFromFile);
        assertEquals(value, valueFromFile);
    }
Tests that serialization of annotations from Java generates the
output expected by the C++ deserialization system.

If the format changes and this test starts failing, you should
generate new golden files to check against. This will cause the C++
test to fail, so you will need to update the
AnnotationDeserialization component to handle the format changes.
document/src/test/java/com/yahoo/document/serialization/SerializeAnnotationsTestCase.java