@Test
public void testEDBObjectToRecursiveModelConversion_shouldWork() throws Exception {

    // prepare
    EDBObject root = new EDBObject("root");
    root.putEDBObjectEntry(EDBConstants.MODEL_TYPE, RecursiveModel.class.getName());
    root.putEDBObjectEntry(EDBConstants.MODEL_OID, "root");
    root.putEDBObjectEntry(EDBConstants.MODEL_VERSION, Integer.valueOf(1));
    root.putEDBObjectEntry("id", "root");
    root.putEDBObjectEntry("child", "child1");
    EDBObject child1 = new EDBObject("child1");
    child1.putEDBObjectEntry(EDBConstants.MODEL_TYPE, RecursiveModel.class.getName());
    child1.putEDBObjectEntry(EDBConstants.MODEL_OID, "child1");
    child1.putEDBObjectEntry(EDBConstants.MODEL_VERSION, Integer.valueOf(1));
    child1.putEDBObjectEntry("id", "child1");
    child1.putEDBObjectEntry("child", "child2");
    EDBObject child2 = new EDBObject("child2");
    child2.putEDBObjectEntry(EDBConstants.MODEL_TYPE, RecursiveModel.class.getName());
    child2.putEDBObjectEntry(EDBConstants.MODEL_OID, "child2");
    child2.putEDBObjectEntry(EDBConstants.MODEL_VERSION, Integer.valueOf(1));
    child2.putEDBObjectEntry("id", "child2");
    child2.putEDBObjectEntry("child", "child3");
    EDBObject child3 = new EDBObject("child3");
    child3.putEDBObjectEntry(EDBConstants.MODEL_TYPE, RecursiveModel.class.getName());
    child3.putEDBObjectEntry(EDBConstants.MODEL_OID, "child3");
    child3.putEDBObjectEntry(EDBConstants.MODEL_VERSION, Integer.valueOf(1));
    child3.putEDBObjectEntry("id", "child3");
    when(mockedService.getObject(eq("child1"), anyLong())).thenReturn(child1);
    when(mockedService.getObject(eq("child2"), anyLong())).thenReturn(child2);
    when(mockedService.getObject(eq("child3"), anyLong())).thenReturn(child3);
    // test
    RecursiveModel mRoot = converter.convertEDBObjectToModel(RecursiveModel.class, root);
    // assert
    assertThat(mRoot.getId(), is("root"));
    RecursiveModel mChild1 = mRoot.getChild();
    assertThat(mChild1, notNullValue());
    assertThat(mChild1.getId(), is("child1"));
    RecursiveModel mChild2 = mChild1.getChild();
    assertThat(mChild2, notNullValue());
    assertThat(mChild2.getId(), is("child2"));
    RecursiveModel mChild3 = mChild2.getChild();
    assertThat(mChild3, notNullValue());
    assertThat(mChild3.getId(), is("child3"));
}