@Test
@FixFor( "MODE-2012" )
public void clonedReferencesShouldPointToTargetWorkspace() throws Exception {

    tools.registerNodeTypes(session, "cnd/references.cnd");
    Node nodeA = session.getRootNode().addNode("A", "test:node");
    Node nodeB = session.getRootNode().addNode("B", "test:node");
    Node nodeC = session.getRootNode().addNode("C", "test:node");
    Node nodeD = session.getRootNode().addNode("D", "test:node");
    nodeA.setProperty("test:strongReference", session.getValueFactory().createValue(nodeB));
    nodeA.setProperty("test:weakReference", session.getValueFactory().createValue(nodeC, true));
    nodeA.setProperty("test:simpleReference", session.getValueFactory().createSimpleReference(nodeD));
    session.save();
    otherWorkspace.clone("default", "/", "/", true);
    nodeD.remove();
    nodeC.remove();
    nodeB.remove();
    nodeA.remove();
    session.save();
    AbstractJcrNode otherA = otherSession.getNode("/A");
    AbstractJcrNode otherB = otherSession.getNode("/B");
    AbstractJcrNode otherC = otherSession.getNode("/C");
    AbstractJcrNode otherD = otherSession.getNode("/D");
    assertEquals(otherB.getIdentifier(), otherA.getProperty("test:strongReference").getNode().getIdentifier());
    assertEquals(otherC.getIdentifier(), otherA.getProperty("test:weakReference").getNode().getIdentifier());
    assertEquals(otherD.getIdentifier(), otherA.getProperty("test:simpleReference").getNode().getIdentifier());
}