CompositeTreePermission implements TreePermission { @Override public boolean isGranted(long permissions) { return grantsPermission(permissions, null); } 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 testIsGrantedUncoveredPermissions() { TreePermission mockTp = when(mock(TreePermission.class).isGranted(anyLong())).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.WRITE)).thenReturn(Permissions.SET_PROPERTY); TreePermission rootTp = createRootTreePermission(mockPP, mockPP); assertFalse(rootTp.isGranted(Permissions.WRITE)); verify(mockTp, times(2)).isGranted(Permissions.SET_PROPERTY); verify(mockTp, never()).isGranted(Permissions.WRITE); verify(mockPP, times(2)).supportedPermissions(mockTp, null, Permissions.WRITE); }