@Test
public void testRecursiveModelToEDBObjectConversion_shouldWork() throws Exception {

    // prepare
    RecursiveModel root = new RecursiveModel();
    root.setId("root");
    RecursiveModel rootChild = new RecursiveModel();
    rootChild.setId("root_child");
    RecursiveModel rootChildChild = new RecursiveModel();
    rootChildChild.setId("root_child_child");
    RecursiveModel rootChildChildChild = new RecursiveModel();
    rootChildChildChild.setId("root_child_child_child");
    root.setChild(rootChild);
    rootChild.setChild(rootChildChild);
    rootChildChild.setChild(rootChildChildChild);
    ConnectorInformation id = getTestConnectorInformation();
    // test
    List<EDBObject> objects = converter.convertModelToEDBObject(root, id);
    // assert
    EDBObject obj = objects.get(3);
    assertThat(obj.getString("id"), is("root"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("child"), is(ModelWrapper.wrap(rootChild).getCompleteModelOID()));
    obj = objects.get(2);
    assertThat(obj.getString("id"), is("root_child"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("child"), is(ModelWrapper.wrap(rootChildChild).getCompleteModelOID()));
    obj = objects.get(1);
    assertThat(obj.getString("id"), is("root_child_child"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("child"), is(ModelWrapper.wrap(rootChildChildChild).getCompleteModelOID()));
    obj = objects.get(0);
    assertThat(obj.getString("id"), is("root_child_child_child"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("child"), nullValue());
}