package org.springframework.security.acls.expression;

import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;

import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.springframework.security.acls.Acl;
import org.springframework.security.acls.AclService;
import org.springframework.security.acls.expression.AclPermissionEvaluator;
import org.springframework.security.acls.objectidentity.ObjectIdentity;
import org.springframework.security.acls.objectidentity.ObjectIdentityRetrievalStrategy;
import org.springframework.security.acls.sid.SidRetrievalStrategy;
import org.springframework.security.core.Authentication;

/**
 *
 * @author Luke Taylor
 * @version $Id$
 * @since 2.5
 */
public class AclPermissionEvaluatorTests {
    Authentication user;
    private AclService service;
    private ObjectIdentityRetrievalStrategy oidStrategy;
    private SidRetrievalStrategy sidStrategy;

    @Before
    public void setup() throws Exception {
        user = mock(Authentication.class);
        service = mock(AclService.class);
        oidStrategy = mock(ObjectIdentityRetrievalStrategy.class);
        sidStrategy = mock(SidRetrievalStrategy.class);
    }

    @Test
    @SuppressWarnings("unchecked")
    public void hasPermissionReturnsTrueIfAclGrantsPermission() throws Exception {
        AclPermissionEvaluator pe = new AclPermissionEvaluator(service);
        final Acl acl = mock(Acl.class);
        pe.setObjectIdentityRetrievalStrategy(oidStrategy);
        pe.setSidRetrievalStrategy(sidStrategy);

        when(service.readAclById(any(ObjectIdentity.class), any(List.class))).thenReturn(acl);
        when(acl.isGranted(any(List.class), any(List.class), false)).thenReturn(true);

        assertTrue(pe.hasPermission(user, new Object(), "READ"));
    }
}

@@ -122,67 +122,56 @@
 to.M
-ockito
+atchers
 .*;%0A
-%0A
 import 
-java.util.List;%0A%0Aimport org.junit.Before;
+static org.mockito.Mockito.*;%0A
 %0Aimp
@@ -293,84 +293,8 @@
 ce;%0A
-import org.springframework.security.acls.expression.AclPermissionEvaluator;%0A
 impo
@@ -686,438 +686,8 @@
 ts %7B
-%0A    Authentication user;%0A    private AclService service;%0A    private ObjectIdentityRetrievalStrategy oidStrategy;%0A    private SidRetrievalStrategy sidStrategy;%0A%0A    @Before%0A    public void setup() throws Exception %7B%0A        user = mock(Authentication.class);%0A        service = mock(AclService.class);%0A        oidStrategy = mock(ObjectIdentityRetrievalStrategy.class);%0A        sidStrategy = mock(SidRetrievalStrategy.class);%0A    %7D
 %0A%0A  
@@ -812,16 +812,69 @@
 ption %7B%0A
+        AclService service = mock(AclService.class);%0A
         
@@ -950,38 +950,227 @@
     
-final Acl acl = mock(Acl.class
+ObjectIdentity oid = mock(ObjectIdentity.class);%0A        ObjectIdentityRetrievalStrategy oidStrategy = mock(ObjectIdentityRetrievalStrategy.class);%0A        when(oidStrategy.getObjectIdentity(anyObject())).thenReturn(oid
 );%0A 
@@ -1267,19 +1267,75 @@
 egy(
-sidStrategy
+mock(SidRetrievalStrategy.class));%0A        Acl acl = mock(Acl.class
 );%0A%0A
@@ -1397,27 +1397,21 @@
 ss), any
-(
 List
-.class
+(
 ))).then
@@ -1457,46 +1457,38 @@
 (any
-(
 List
-.class
+(
 ), any
-(
 List
-.class), 
+(), eq(
 false))
+)
 .the
@@ -1543,12 +1543,34 @@
 ion(
-user
+mock(Authentication.class)
 , ne

Fix mockito usage error.