diff options
Diffstat (limited to 'document/src/test')
-rw-r--r-- | document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java index daa65d6e95e..a1d69238463 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/ReferenceFieldValueTestCase.java @@ -13,6 +13,7 @@ import org.junit.rules.ExpectedException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; /** @@ -189,4 +190,16 @@ public class ReferenceFieldValueTestCase { value.assign(newId); } + @Test + public void exposed_wrapped_value_is_null_for_empty_reference() { + ReferenceFieldValue nullRef = new ReferenceFieldValue(referenceTypeFoo()); + assertNull(nullRef.getWrappedValue()); + } + + @Test + public void expose_wrapped_value_is_doc_id_for_non_empty_reference() { + ReferenceFieldValue idRef = new ReferenceFieldValue(referenceTypeFoo(), docId("id:ns:foo::toad")); + assertEquals(docId("id:ns:foo::toad"), idRef.getWrappedValue()); + } + } |