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

        final Field field = book.getField("ref");
        final FieldValue value = book.getFieldValue(field);
        assertTrue(value instanceof ReferenceFieldValue);
        final ReferenceFieldValue refValue = (ReferenceFieldValue)value;
        assertEquals(field.getDataType(), refValue.getDataType());
        assertTrue(refValue.getDocumentId().isPresent());
        assertEquals(docId, refValue.getDocumentId().get());
    }
Tests vespa-documentgen-plugin

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