ImmutableTree extends AbstractTree implements TreeTypeAware, ReadOnly { @Override public boolean orderBefore(@Nullable String name) { throw new UnsupportedOperationException(); } ImmutableTree(@NotNull NodeState rootState);  ImmutableTree(@NotNull ImmutableTree parent, @NotNull String name, @NotNull NodeState state);  ImmutableTree(@NotNull ParentProvider parentProvider, @NotNull String name, @NotNull NodeState state); @Nullable TreeType getType(); void setType(@NotNull TreeType type); @Override boolean isRoot(); @NotNull @Override String getName(); @Override @NotNull String getPath(); @NotNull @Override ImmutableTree getChild(@NotNull String name); @Override boolean remove(); @Override @NotNull Tree addChild(@NotNull String name); @Override void setOrderableChildren(boolean enable); @Override boolean orderBefore(@Nullable String name); @Override void setProperty(@NotNull PropertyState property); @Override void setProperty(@NotNull String name, @NotNull T value); @Override void setProperty(@NotNull String name, @NotNull T value, @NotNull Type<T> type); @Override void removeProperty(@NotNull String name); @Override int hashCode(); @Override boolean equals(Object o);  }
@Test public void orderBefore() throws Exception { Tree t = root.getTree("/x/y/z"); NodeUtil n = new NodeUtil(t); n.addChild("node1", JcrConstants.NT_UNSTRUCTURED); n.addChild("node2", JcrConstants.NT_UNSTRUCTURED); n.addChild("node3", JcrConstants.NT_UNSTRUCTURED); t.getChild("node1").orderBefore("node2"); t.getChild("node3").orderBefore(null); root.commit(); ImmutableTree tree = new ImmutableTree(((AbstractTree) t).getNodeState()); assertSequence(tree.getChildren(), "node1", "node2", "node3"); t.getChild("node3").orderBefore("node2"); root.commit(); tree = new ImmutableTree(((AbstractTree) t).getNodeState()); assertSequence(tree.getChildren(), "node1", "node3", "node2"); t.getChild("node1").orderBefore(null); root.commit(); tree = new ImmutableTree(((AbstractTree) t).getNodeState()); assertSequence(tree.getChildren(), "node3", "node2", "node1"); }