@Test
@FixFor("MODE-2096")
public void shouldReorderTransientChildren() throws Exception {

    Node parent = session.getRootNode().addNode("parent", "nt:unstructured");
    try {
        parent.addNode("child1");
        parent.addNode("child2");
        parent.addNode("child3");
        parent.addNode("child4");
        parent.orderBefore("child4", "child3");
        parent.orderBefore("child3", "child2");
        parent.orderBefore("child2", "child1");
        session.save();
        List<String> paths = new ArrayList<String>();
        NodeIterator nodeIterator = parent.getNodes();
        while (nodeIterator.hasNext()) {
            paths.add(nodeIterator.nextNode().getPath());
        }
        assertEquals(Arrays.asList("/parent/child4", "/parent/child3", "/parent/child2", "/parent/child1"), paths);
    } finally {
        parent.remove();
        session.save();
    }
}