@Test
@FixFor("MODE-2034")
public void shouldReorderChildrenWithChanges() throws Exception {

    Node parent = session.getRootNode().addNode("parent", "nt:unstructured");
    try {
        Node child1 = parent.addNode("child1");
        Node child2 = parent.addNode("child2");
        session.save();
        parent.orderBefore("child2", "child1");
        child1.setProperty("prop", "value");
        child2.setProperty("prop", "value");
        session.save();
        NodeIterator nodeIterator = parent.getNodes();
        long childIdx = nodeIterator.getSize();
        while (nodeIterator.hasNext()) {
            Node child = nodeIterator.nextNode();
            assertEquals("child" + childIdx, child.getName());
            childIdx--;
        }
    } finally {
        parent.remove();
        session.save();
    }
}