use of com.yahoo.document.datatypes.ReferenceFieldValue in project vespa by vespa-engine.
the class JsonWriterTestCase method non_empty_reference_field_results_in_reference_value_with_doc_id_present.
@Test
public void non_empty_reference_field_results_in_reference_value_with_doc_id_present() throws IOException {
final Document doc = readDocumentFromJson("id:unittest:testrefs::helloworld", "{ \"ref_field\": \"id:unittest:smoke::and_mirrors_too\" }");
ReferenceFieldValue ref = (ReferenceFieldValue) doc.getFieldValue("ref_field");
assertTrue(ref.getDocumentId().isPresent());
assertEquals(new DocumentId("id:unittest:smoke::and_mirrors_too"), ref.getDocumentId().get());
}
use of com.yahoo.document.datatypes.ReferenceFieldValue in project vespa by vespa-engine.
the class JsonWriterTestCase method empty_reference_field_results_in_reference_value_without_doc_id_present.
@Test
public void empty_reference_field_results_in_reference_value_without_doc_id_present() throws IOException {
final Document doc = readDocumentFromJson("id:unittest:testrefs::helloworld", "{ \"ref_field\": \"\" }");
ReferenceFieldValue ref = (ReferenceFieldValue) doc.getFieldValue("ref_field");
assertFalse(ref.getDocumentId().isPresent());
}
use of com.yahoo.document.datatypes.ReferenceFieldValue in project vespa by vespa-engine.
the class ReferenceDataTypeTestCase method empty_reference_field_value_instance_can_be_created_from_type.
@Test
public void empty_reference_field_value_instance_can_be_created_from_type() {
ReferenceDataType refType = new ReferenceDataType(new DocumentType("foo"), 123);
ReferenceFieldValue fv = refType.createFieldValue();
assertNotNull(fv);
assertEquals(refType, fv.getDataType());
}
Aggregations