@Test
public void flatDocToMap() {

    ODocument doc = new ODocument();
    doc.field(DocumentUtil.ORIENTDB_PRIMARY_KEY, "client-assigned-id");
    doc.field("firstname", "Sam");
    doc.field("lastname", "Iam");
    doc.field("telephone", "(555) 123-4567");
    doc.field("age", 20);
    doc.field("longnumber", Long.MAX_VALUE);
    doc.field("amount", Float.valueOf(12345678.89f));
    doc.field("present", Boolean.FALSE);
    doc.field("somedate", new Date());
    Map result = DocumentUtil.toMap(doc);
    
    assertThat(result).includes(
            entry(DocumentUtil.TAG_ID, "client-assigned-id"), //"-1:-1"), // ID when doc not yet stored
            entry(DocumentUtil.TAG_REV, "0"),      // Doc version starts at 0
            entry("firstname", "Sam"), 
            entry("lastname", "Iam"), 
            entry("telephone", "(555) 123-4567"),
            entry("age", 20),
            entry("longnumber", Long.MAX_VALUE),
            entry("amount", 12345678.89f),
            entry("present", false));
    
    Object somedate = result.get("somedate");
    assertNotNull(somedate, "somedate entry null");
    assertThat(somedate).isInstanceOf(Date.class);
    
    // The ID should appear in map not as the key we use for OrientDB internal
    assertFalse(result.containsKey(DocumentUtil.ORIENTDB_PRIMARY_KEY), "DB layer internal key " + DocumentUtil.ORIENTDB_PRIMARY_KEY 
            + " should not appear in map, but did.");
}