@Test
public void testRecursiveModelWithCompositionToEDBObjectConversion_shouldWork() throws Exception {

    // prepare
    RecursiveModel root = new RecursiveModel("root");
    RecursiveModel rootChild1 = new RecursiveModel("root_child1");
    RecursiveModel rootChild2 = new RecursiveModel("root_child2");
    RecursiveModel child1Child1 = new RecursiveModel("child1_child1");
    RecursiveModel child2Child1 = new RecursiveModel("child2_child1");
    RecursiveModel child2Child2 = new RecursiveModel("child2_child2");
    List<RecursiveModel> rootChildren = Arrays.asList(new RecursiveModel[]{ rootChild1, rootChild2 });
    List<RecursiveModel> child2Children = Arrays.asList(new RecursiveModel[]{ child2Child1, child2Child2 });
    root.setChildren(rootChildren);
    rootChild1.setChild(child1Child1);
    rootChild2.setChildren(child2Children);
    ConnectorInformation id = getTestConnectorInformation();
    // test
    List<EDBObject> objects = converter.convertModelToEDBObject(root, id);
    // assert
    EDBObject obj = objects.get(5);
    assertThat(obj.getString("id"), is("root"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("children.0"), is(ModelWrapper.wrap(rootChild1).getCompleteModelOID()));
    assertThat(obj.getString("children.1"), is(ModelWrapper.wrap(rootChild2).getCompleteModelOID()));
    obj = objects.get(4);
    assertThat(obj.getString("id"), is("root_child2"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("children.0"), is(ModelWrapper.wrap(child2Child1).getCompleteModelOID()));
    assertThat(obj.getString("children.1"), is(ModelWrapper.wrap(child2Child2).getCompleteModelOID()));
    obj = objects.get(3);
    assertThat(obj.getString("id"), is("child2_child2"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    obj = objects.get(2);
    assertThat(obj.getString("id"), is("child2_child1"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    obj = objects.get(1);
    assertThat(obj.getString("id"), is("root_child1"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
    assertThat(obj.getString("child"), is(ModelWrapper.wrap(child1Child1).getCompleteModelOID()));
    obj = objects.get(0);
    assertThat(obj.getString("id"), is("child1_child1"));
    assertThat(obj.getString(EDBConstants.MODEL_TYPE), is(RecursiveModel.class.getName()));
}