CompositeTreePermission implements TreePermission { @Override public boolean canReadProperties() { if (canReadProperties == null) { canReadProperties = grantsReadProperties(); } return canReadProperties; } 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 testCanReadProperties() { PropertyState ps = PropertyStates.createProperty("propName", "value"); TreePermission mockTp = when(mock(TreePermission.class).canReadProperties()).thenReturn(true).getMock(); when(mockTp.canRead(ps)).thenReturn(false); 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_PROPERTY)).thenReturn(Permissions.ALL); TreePermission rootTp = createRootTreePermission(mockPP, fullScopeProvider); rootTp.canReadProperties(); rootTp.canReadProperties(); rootTp.canRead(ps); verify(mockTp, never()).canRead(); verify(mockTp, times(1)).canReadProperties(); verify(mockTp, never()).canRead(ps); verify(mockTp, never()).canReadAll(); }