@Test
public void testVisitElementWithSubs() throws Exception {

  SessionContext context = TestUtils.createSessionContext(USER, "test");
  ElementContext elementContext = new ElementContext(new Id(), new Id());
  Space space = Space.PRIVATE;
  CoreElement element = new CoreElement();
  element.setId(new Id());
  element.setNamespace(Namespace.ROOT_NAMESPACE);
  element.setSubElements(Arrays.asList(new CoreElement(), new CoreElement(), new CoreElement()));
  visitor.visit(context, elementContext, space, element);
  verify(elementCommandFactoryMock).executeCommand(context, elementContext, space, element);
  element.getSubElements().forEach(subElement -> {
    Assert.assertEquals(subElement.getParentId(), element.getId());
    Assert.assertEquals(subElement.getNamespace(),
        new Namespace(element.getNamespace(), element.getId()));
  });
}