ImmutableTree extends AbstractTree implements TreeTypeAware, ReadOnly { @Nullable public TreeType getType() { return type; } 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 testGetTypeForImmutableTree() { TreeTypeProvider typeProvider = new TreeTypeProvider(getConfig(AuthorizationConfiguration.class).getContext()); for (String path : new String[] {"/", "/testPath"}) { Tree t = getRootProvider().createReadOnlyRoot(root).getTree(path); assertEquals(TreeType.DEFAULT, typeProvider.getType(t)); assertEquals(TreeType.DEFAULT, typeProvider.getType(t)); assertEquals(TreeType.DEFAULT, typeProvider.getType(t, TreeType.DEFAULT)); assertEquals(TreeType.DEFAULT, typeProvider.getType(t, TreeType.HIDDEN)); } }
@Test public void testGetTypeForImmutableTreeWithParent() { TreeTypeProvider typeProvider = new TreeTypeProvider(getConfig(AuthorizationConfiguration.class).getContext()); Tree t = getRootProvider().createReadOnlyRoot(root).getTree("/:hidden/testPath"); assertEquals(TreeType.HIDDEN, typeProvider.getType(t, TreeType.HIDDEN)); assertEquals(TreeType.HIDDEN, typeProvider.getType(t)); assertEquals(TreeType.HIDDEN, typeProvider.getType(t, TreeType.DEFAULT)); assertEquals(TreeType.HIDDEN, typeProvider.getType(t, TreeType.ACCESS_CONTROL)); assertEquals(TreeType.HIDDEN, typeProvider.getType(t, TreeType.VERSION)); }