Code example for Subject

Methods: getPrincipals

0
            public String getName() {
                return "principal"; 
            } 
        }; 
 
        Subject subject = new Subject();
 
        subject.getPrincipals().add(principal);
 
        SubjectDomainCombiner combiner = new SubjectDomainCombiner(subject);
 
        ProtectionDomain[] pd;
 
        // test case: both parameters are null 
        assertNull(combiner.combine(null, null));
 
        // test case: check assigned principals 
        URL url = new URL("file://foo.txt");
 
        CodeSource source = new CodeSource(url, (Certificate[]) null);
        PermissionCollection permissions = new Permissions();