Code example for PermissionCollection

Methods: addimplies

0
    public void testImpliesCollection(){ 
         
        Permission ap = new AllPermission();
        Permission p = new ServicePermission("AAA", "accept");
        PermissionCollection pc = p.newPermissionCollection();
        assertFalse(pc.implies(ap));
        assertFalse(pc.implies(p));
        pc.add(p);
        assertTrue(pc.implies(p));
        assertFalse(pc.implies(null));
        assertFalse(pc.implies(new ServicePermission("BBB", "initiate")));
        assertFalse(pc.implies(new ServicePermission("CCC", "accept")));
        pc.add(new ServicePermission("*", "accept, initiate"));
        assertTrue(pc.implies(new ServicePermission("*", "accept")));
        assertTrue(pc.implies(new ServicePermission("*", "initiate")));
        assertTrue(pc.implies(new ServicePermission("BBB", "initiate")));
        assertTrue(pc.implies(new ServicePermission("CCC", "accept")));
 
         
    } 
     
    public void testElements() {