@Test
public void testSaveWithNonCreateRoot() throws Exception {

  CoreElement root = createCoreElement(new Id(), Action.UPDATE, null, null, "root", null);
  SessionContext context = TestUtils.createSessionContext(USER, "test");
  ElementContext elementContext = new ElementContext(new Id(), new Id());
  Id parentElementId = new Id();
  Namespace namespace = new Namespace(Namespace.ROOT_NAMESPACE, parentElementId);
  doReturn(new Response<>(namespace))
      .when(stateAdaptorMock).getNamespace(context, elementContext.getItemId(), root.getId());
  CoreElement returnedRoot =
      elementManager.save(context, elementContext, root, "save non-create root!");
  Assert.assertEquals(returnedRoot.getId(), root.getId());
  Assert.assertEquals(root.getParentId(), parentElementId);
  Assert.assertEquals(root.getNamespace(), namespace);
  verify(traverserMock)
      .traverse(context, elementContext, Space.PRIVATE, root, collaborativeStoreVisitorMock);
  verify(traverserMock).traverse(context, elementContext, Space.PRIVATE, root,
      indexingVisitorMock);
}