TrustedUserPrincipal extends Principal { @Override public boolean canAccess(Object target, SubResource subResource, Access access) { return true; } TrustedUserPrincipal(String username); String getUsername(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String getType(); @Override String getName(); @Override boolean hasFullAccess(); @Override boolean canAccess(Object target, SubResource subResource, Access access);  }
@Test public void access() { Consumer c = mock(Consumer.class); Pool p = mock(Pool.class); assertTrue(principal.canAccess(c, SubResource.NONE, Access.ALL)); assertTrue(principal.canAccess(null, SubResource.NONE, Access.NONE)); assertTrue(principal.canAccessAll(null, SubResource.NONE, Access.NONE)); assertTrue(principal.canAccess(p, SubResource.NONE, Access.ALL)); assertTrue(principal.canAccess("always true", SubResource.NONE, Access.READ_ONLY)); }