@Test public void isDisabledReturnsFalseWhenConfigurationIsMissing() throws ComponentLookupException { when(this.dab.getProperty(new ObjectPropertyReference("disabledLevels", new BaseObjectReference(this.visibilityConfigurationClassReference, 0, this.preferencesDocumentReference)))) .thenReturn(null); Assert.assertFalse(this.mocker.getComponentUnderTest().isVisibilityDisabled("private")); Assert.assertFalse(this.mocker.getComponentUnderTest().isVisibilityDisabled("open")); }
@Override public boolean isVisibilityDisabled(String visibilityName) { DocumentReference preferencesDocument = this.resolver.resolve(PREFERENCES_DOCUMENT); DocumentReference configurationClassDocument = this.resolver.resolve(VISIBILITY_CONFIGURATION_CLASS_REFERENCE); @SuppressWarnings("unchecked") List<String> disabledVisibilities = (List<String>) this.dab.getProperty(new ObjectPropertyReference("disabledLevels", new BaseObjectReference(configurationClassDocument, 0, preferencesDocument))); return disabledVisibilities != null && disabledVisibilities.contains(visibilityName); }
DefaultPermissionsConfiguration implements PermissionsConfiguration { @Override public boolean isVisibilityDisabled(String visibilityName) { DocumentReference preferencesDocument = this.resolver.resolve(PREFERENCES_DOCUMENT); DocumentReference configurationClassDocument = this.resolver.resolve(VISIBILITY_CONFIGURATION_CLASS_REFERENCE); @SuppressWarnings("unchecked") List<String> disabledVisibilities = (List<String>) this.dab.getProperty(new ObjectPropertyReference("disabledLevels", new BaseObjectReference(configurationClassDocument, 0, preferencesDocument))); return disabledVisibilities != null && disabledVisibilities.contains(visibilityName); } }
DefaultPermissionsConfiguration implements PermissionsConfiguration { @Override public boolean isVisibilityDisabled(String visibilityName) { DocumentReference preferencesDocument = this.resolver.resolve(PREFERENCES_DOCUMENT); DocumentReference configurationClassDocument = this.resolver.resolve(VISIBILITY_CONFIGURATION_CLASS_REFERENCE); @SuppressWarnings("unchecked") List<String> disabledVisibilities = (List<String>) this.dab.getProperty(new ObjectPropertyReference("disabledLevels", new BaseObjectReference(configurationClassDocument, 0, preferencesDocument))); return disabledVisibilities != null && disabledVisibilities.contains(visibilityName); }  }
DefaultPermissionsConfiguration implements PermissionsConfiguration { @Override public boolean isVisibilityDisabled(String visibilityName) { DocumentReference preferencesDocument = this.resolver.resolve(PREFERENCES_DOCUMENT); DocumentReference configurationClassDocument = this.resolver.resolve(VISIBILITY_CONFIGURATION_CLASS_REFERENCE); @SuppressWarnings("unchecked") List<String> disabledVisibilities = (List<String>) this.dab.getProperty(new ObjectPropertyReference("disabledLevels", new BaseObjectReference(configurationClassDocument, 0, preferencesDocument))); return disabledVisibilities != null && disabledVisibilities.contains(visibilityName); }  @Override String getDefaultVisibility(); @Override boolean isVisibilityDisabled(String visibilityName); }
DefaultPermissionsConfiguration implements PermissionsConfiguration { @Override public boolean isVisibilityDisabled(String visibilityName) { DocumentReference preferencesDocument = this.resolver.resolve(PREFERENCES_DOCUMENT); DocumentReference configurationClassDocument = this.resolver.resolve(VISIBILITY_CONFIGURATION_CLASS_REFERENCE); @SuppressWarnings("unchecked") List<String> disabledVisibilities = (List<String>) this.dab.getProperty(new ObjectPropertyReference("disabledLevels", new BaseObjectReference(configurationClassDocument, 0, preferencesDocument))); return disabledVisibilities != null && disabledVisibilities.contains(visibilityName); }  @Override String getDefaultVisibility(); @Override boolean isVisibilityDisabled(String visibilityName);  }