@Test
    public void reference_field_value_can_be_transparently_converted_to_concrete_reference_id() {
        final Book book = getBook();
        final DocumentId docId = new DocumentId("id:ns:parent::bar");
        final Field field = book.getField("ref");
        book.setFieldValue(field, new ReferenceFieldValue((ReferenceDataType)field.getDataType(), docId));

        assertEquals(docId, book.getRef());
    }
Tests vespa-documentgen-plugin

@author vegardh
documentgen-test/src/test/java/com/yahoo/vespa/config/DocumentGenPluginTest.java