private static Document roundtripSerialize(Document docToSerialize, DocumentTypeManager mgr) {
        final GrowableByteBuffer outputBuffer = new GrowableByteBuffer();
        final DocumentSerializer serializer = DocumentSerializerFactory.createHead(outputBuffer);
        serializer.write(docToSerialize);
        outputBuffer.flip();
        return new Document(DocumentDeserializerFactory.createHead(mgr, outputBuffer));
    }
Packs the given doc to Book
@param d doc, never null
@return a Book object or null if input doc isn't a Book
documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java