Code example for CodeSource

0
    public void testCtor() { 
        PolicyEntry pe = new PolicyEntry(null, null, null);
        assertTrue(pe.isVoid());
        assertNull(pe.getPermissions());
 
        pe = new PolicyEntry(new CodeSource(null, (Certificate[])null),
            new ArrayList(), new ArrayList());
        assertTrue(pe.isVoid());
        assertNull(pe.getPermissions());
 
        Collection perms = Arrays.asList(new Permission[] {
            new SecurityPermission("dsfg"), new AllPermission() });
        pe = new PolicyEntry(null, null, perms);
        assertFalse(pe.isVoid());
        assertEquals(perms, new ArrayList(pe.getPermissions()));
    } 
 
    /** 
     * Null CodeSource of PolicyEntry implies any CodeSource; non-null 
     * CodeSource should delegate to its own imply() functionality 
     */