  @Test
  public void shouldHasPermissionWhenUserIsSuperUser() {

    // Given
    UserACL userACL = mock(UserACL.class);
    when(userACL.getSuperUser()).thenReturn("john");
    SpacesAdministrationService spacesAdministrationService = mock(SpacesAdministrationService.class);
    when(spacesAdministrationService.getSpacesAdministratorsMemberships()).thenReturn(Arrays.asList(new MembershipEntry("/platform/spacesadmins",
                                                                                                                        "*")));
    GroupVisibilityPlugin plugin = new SpaceCreationInvitationGroupVisibilityPlugin(userACL, spacesAdministrationService);

    Identity userIdentity = new Identity("john", Arrays.asList(new MembershipEntry("/platform/users", "manager")));
    Group groupPlatform = new GroupImpl();
    groupPlatform.setId("/platform");
    Group groupPlatformUsers = new GroupImpl();
    groupPlatformUsers.setId("/platform/users");

    // When
    boolean hasPermissionOnPlatform = plugin.hasPermission(userIdentity, groupPlatform);
    boolean hasPermissionOnPlatformUsers = plugin.hasPermission(userIdentity, groupPlatformUsers);

    // Then
    assertTrue(hasPermissionOnPlatform);
    assertTrue(hasPermissionOnPlatformUsers);
  }