### Question:
AbstractModelPermissionEvaluator implements ModelPermissionEvaluator<T> { @Override public boolean hasPermission(Authentication authentication, T targetDomainObject, Permission permission) { return AuthenticationUtils.isAdmin(authentication); }  @Override boolean hasPermission(Authentication authentication, T targetDomainObject, Permission permission); @Override int getLoadOrder();  }### Answer:
@Test public void testHasPermission_authenticationUserIsAdmin() { List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>(); grantedAuthoritiesList.add(new SimpleGrantedAuthority(AuthenticationUtils.ROLE_ADMIN)); EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList); replay(authentication); assertThat(fooModelPermissionEvaluator.hasPermission(authentication, fooModel, Permission.READ), is(true)); verify(authentication); }
@Test public void testHasPermission_authenticationUserIsNotAdmin() { List<GrantedAuthority> grantedAuthoritiesList = new ArrayList<GrantedAuthority>(); grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_THAT_IS_NOT_ADMIN")); EasyMock.<Collection<? extends GrantedAuthority>>expect(authentication.getAuthorities()).andReturn(grantedAuthoritiesList); replay(authentication); assertThat(fooModelPermissionEvaluator.hasPermission(authentication, fooModel, Permission.READ), is(false)); verify(authentication); }
@Test public void testHasPermission_nullAuthorities() { expect(authentication.getAuthorities()).andReturn(null); replay(authentication); assertThat(fooModelPermissionEvaluator.hasPermission(authentication, fooModel, Permission.READ), is(false)); verify(authentication); }