UserPrincipal extends Principal { @Override public boolean hasFullAccess() { return this.admin; } UserPrincipal(String username, Collection<Permission> permissions, boolean admin); String getUsername(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String getType(); @Override String getName(); @Override boolean hasFullAccess(); List<String> getOwnerIds(); List<String> getOwnerKeys(); List<Owner> getOwners(); @Override boolean canAccess(Object target, SubResource subResource, Access access);  }
@Test public void defaultsToAdmin() { assertTrue(user.hasFullAccess()); }
@Test public void shouldNotBeAnAdmin() { UserPrincipal up = new UserPrincipal("notadmin", null, false); assertFalse(up.hasFullAccess()); }