PermissionUtil implements PermissionConstants { @NotNull public static Tree getReadOnlyTree(@NotNull Tree tree, @NotNull Root readOnlyRoot) { if (tree instanceof ReadOnly) { return tree; } else { return readOnlyRoot.getTree(tree.getPath()); } } private  PermissionUtil(); @Nullable static String getParentPathOrNull(@NotNull final String path); @NotNull static String getEntryName(@Nullable String accessControlledPath); static boolean checkACLPath(@NotNull NodeBuilder node, @NotNull String path); static boolean checkACLPath(@NotNull Tree node, @NotNull String path); @NotNull static Tree getPermissionsRoot(@NotNull Root root, @NotNull String permissionRootName); @NotNull static Tree getPrincipalRoot(@NotNull Tree permissionsTree, @NotNull String principalName); static boolean isAdminOrSystem(@NotNull Set<Principal> principals, @NotNull ConfigurationParameters config); @Nullable static String getPath(@Nullable Tree parentBefore, @Nullable Tree parentAfter); @Nullable static Tree getReadOnlyTreeOrNull(@Nullable Tree tree, @NotNull Root readOnlyRoot); @NotNull static Tree getReadOnlyTree(@NotNull Tree tree, @NotNull Root readOnlyRoot);  }
@Test public void testGetReadOnlyTree() { Tree readOnlyTree = mock(Tree.class, withSettings().extraInterfaces(ReadOnly.class)); Root r = mock(Root.class); assertSame(readOnlyTree, PermissionUtil.getReadOnlyTree(readOnlyTree, r)); verify(r, never()).getTree(anyString()); }