CompositeTreePermission implements TreePermission { @Override public boolean canReadAll() { return false; } private  CompositeTreePermission(@NotNull Tree tree, @NotNull TreeType type,
                                    @NotNull TreeProvider treeProvider,
                                    @NotNull TreeTypeProvider typeProvider,
                                    @NotNull AggregatedPermissionProvider[] providers,
                                    @NotNull TreePermission[] treePermissions, int cnt); @NotNull @Override TreePermission getChildPermission(@NotNull final String childName, @NotNull final NodeState childState); @Override boolean canRead(); @Override boolean canRead(@NotNull PropertyState property); @Override boolean canReadAll(); @Override boolean canReadProperties(); @Override boolean isGranted(long permissions); @Override boolean isGranted(long permissions, @NotNull PropertyState property);  }
@Test public void testCanReadAll() { TreePermission mockTp = when(mock(TreePermission.class).canReadAll()).thenReturn(true).getMock(); AggregatedPermissionProvider mockPP = mock(AggregatedPermissionProvider.class); when(mockPP.getTreePermission(any(Tree.class), any(TreeType.class), any(TreePermission.class))).thenReturn(mockTp); when(mockPP.supportedPermissions(mockTp, null, Permissions.READ_NODE)).thenReturn(Permissions.ALL); TreePermission rootTp = createRootTreePermission(mockPP, fullScopeProvider); assertFalse(rootTp.canReadAll()); verify(mockTp, never()).canReadAll(); }