@SuppressWarnings("unchecked")
    public void validateCppDocNotMap(Document doc) {
        // in practice to validate v6 serialization
        assertEquals("id:ns:serializetest::http://test.doc.id/", doc.getId().toString());
        assertEquals(new IntegerFieldValue(5), doc.getFieldValue("intfield"));
        assertEquals(new FloatFieldValue((float)-9.23), doc.getFieldValue("floatfield"));
        assertEquals(new StringFieldValue("This is a string."), doc.getFieldValue("stringfield"));
        assertEquals(new LongFieldValue(398420092938472983L), doc.getFieldValue("longfield"));
        assertEquals(new DoubleFieldValue(98374532.398820d), doc.getFieldValue("doublefield"));
        assertEquals(new StringFieldValue("http://this.is.a.test/"), doc.getFieldValue("urifield"));
        //NOTE: The value really is unsigned 254, which becomes signed -2:
        assertEquals(new ByteFieldValue(-2), doc.getFieldValue("bytefield"));
        ByteBuffer raw = ByteBuffer.wrap("RAW DATA".getBytes());
        assertEquals(new Raw(raw), doc.getFieldValue("rawfield"));

        Document docindoc = (Document)doc.getFieldValue("docfield");
        assertEquals(docMan.getDocumentType("docindoc"), docindoc.getDataType());
        assertEquals(new DocumentId("id:ns:docindoc::http://embedded"), docindoc.getId());

        Array<FloatFieldValue> array = (Array<FloatFieldValue>)doc.getFieldValue("arrayoffloatfield");
        assertEquals(new FloatFieldValue(1.0f), array.get(0));
        assertEquals(new FloatFieldValue(2.0f), array.get(1));

        WeightedSet<StringFieldValue> wset = (WeightedSet<StringFieldValue>)doc.getFieldValue("wsfield");
        assertEquals(Integer.valueOf(50), wset.get(new StringFieldValue("Weighted 0")));
        assertEquals(Integer.valueOf(199), wset.get(new StringFieldValue("Weighted 1")));
    }
Test for Document and all its features, including (de)serialization.

@author Thomas Gundersen
@author bratseth
document/src/test/java/com/yahoo/document/DocumentTestCase.java