@Test
public void embeddedDocToMap() {

    ODocument doc = new ODocument();
    doc.field(DocumentUtil.ORIENTDB_PRIMARY_KEY, "client-assigned-id");
    doc.field("firstname", "John");
    doc.field("lastname", "Doe");
    doc.field("city", new ODocument().field("name","Paris").field("country", "France"));
    doc.field("phonenumbers", new ODocument().field("home","555-666-7777").field("mobile", "555-111-2222"), OType.EMBEDDED);
    
    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", "John"), 
            entry("lastname", "Doe"));
    Object city = result.get("city");
    assertNotNull(city, "city map entry null");
    assertThat(city).isInstanceOf(Map.class);
    assertThat((Map)city)
            .hasSize(2)
            .includes(entry("name", "Paris"), entry("country", "France"));
    
    Object phonenumbers = result.get("phonenumbers");
    assertNotNull(phonenumbers, "phonenumbers map entry null");
    assertThat(phonenumbers).isInstanceOf(Map.class);
    assertThat((Map)phonenumbers)
            .hasSize(2)
            .includes(entry("home", "555-666-7777"), entry("mobile", "555-111-2222"));
}