boolean isVisible(String key, Optional<EntityDto> component) {
    if (isAdmin(component)) {
      return true;
    }
    return hasPermission(GlobalPermission.SCAN, UserRole.SCAN, component) || !isProtected(key);
  }
@Test
  public void isVisible() {
    openMocks(this);
    when(userSession.isSystemAdministrator()).thenReturn(isAdmin);
    when(userSession.hasPermission(GlobalPermission.SCAN)).thenReturn(hasGlobalPermission);
    when(userSession.hasEntityPermission(UserRole.SCAN, componentDto)).thenReturn(hasComponentPermission);

    boolean isVisible = settingsWsSupport.isVisible(property, Optional.of(componentDto));
    assertThat(isVisible).isEqualTo(expectedIsVisible);
  }