mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
refactor: replace anonymous types with lambdas
This commit is contained in:
@@ -34,27 +34,23 @@ package sonia.scm.security;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import org.apache.shiro.mgt.DefaultSecurityManager;
|
||||
import org.apache.shiro.realm.SimpleAccountRealm;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import sonia.scm.AbstractTestBase;
|
||||
import sonia.scm.store.JAXBConfigurationEntryStoreFactory;
|
||||
import sonia.scm.util.MockUtil;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -184,15 +180,7 @@ public class DefaultSecuritySystemTest extends AbstractTestBase
|
||||
createPermission("hitchhiker", true, "repository:*:READ");
|
||||
|
||||
List<StoredAssignedPermission> filtered =
|
||||
securitySystem.getPermissions(new Predicate<AssignedPermission>()
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean apply(AssignedPermission input)
|
||||
{
|
||||
return !input.isGroupPermission();
|
||||
}
|
||||
});
|
||||
securitySystem.getPermissions(input -> !(input != null && input.isGroupPermission()));
|
||||
|
||||
assertEquals(2, filtered.size());
|
||||
assertThat(filtered, containsInAnyOrder(trillian, dent));
|
||||
|
||||
Reference in New Issue
Block a user