@Test
    public void concrete_reference_fields_can_be_roundtrip_serialized() {
        final Book book = getBook();
        final DocumentId id = new DocumentId("id:ns:parent::baz");
        book.setRef(id);

        final Document doc = roundtripSerialize(book, typeManagerForBookType());
        final ReferenceFieldValue refValue = (ReferenceFieldValue) doc.getFieldValue(doc.getField("ref"));
        assertTrue(refValue.getDocumentId().isPresent());
        assertEquals(id, refValue.getDocumentId().get());

        final Book bookCopy = (Book)new ConcreteDocumentFactory().getDocumentCopy(
                "book", doc, new DocumentId("id:ns:book::helloworld"));
        assertEquals(id, bookCopy.getRef());
    }
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