@Test
    public void testTimestamp() {
        Document doc = new Document(docMan.getDocumentType("testdoc"), new DocumentId("id:ns:testdoc::timetest"));
        assertNull(doc.getLastModified());
        doc.setLastModified(4350129845023985L);
        assertEquals(Long.valueOf(4350129845023985L), doc.getLastModified());
        doc.setLastModified(null);
        assertNull(doc.getLastModified());

        Long timestamp = System.currentTimeMillis();
        doc.setLastModified(timestamp);
        assertEquals(timestamp, doc.getLastModified());

        GrowableByteBuffer buf = new GrowableByteBuffer();
        doc.getSerializedSize();
        doc.serialize(buf);
        buf.position(0);

        Document doc2 = docMan.createDocument(buf);
        assertNull(doc2.getLastModified());
    }
Test for Document and all its features, including (de)serialization.

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