Code example for PKIXParameters

Methods: addCertPathChecker, getCertPathCheckers, setCertPathCheckers

0
        Set taSet = TestUtils.getTrustAnchorSet();
        if (taSet == null) {
            fail(getName() + ": not performed (could not create test TrustAnchor set)");
        } 
 
        PKIXParameters p = new PKIXParameters(taSet);
        PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
        List l = new ArrayList();
        assertTrue("addedOk", l.add(cpc));
        p.setCertPathCheckers(l);
        // try to add null 
        p.addCertPathChecker(null);
        // check that we have one PKIXCertPathChecker 
        List l1 = p.getCertPathCheckers();
        assertEquals("listSize", 1, l1.size());
    } 
 
    /** 
     * Test #3 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br> 
     * Assertion: <code>PKIXCertPathChecker</code> is cloned to protect 
     * against subsequent modifications