Search in sources :

Example 1 with MyCertPathBuilderSpi

use of org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi in project robovm by robovm.

the class myCertPathBuilder method testCertPathBuilder12.

/**
     * Test for
     * <code>CertPathBuilder</code> constructor
     * Assertion: returns CertPathBuilder object
     */
public void testCertPathBuilder12() throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, CertPathBuilderException {
    if (!PKIXSupport) {
        fail(NotSupportMsg);
        return;
    }
    CertPathBuilderSpi spi = new MyCertPathBuilderSpi();
    CertPathBuilder certPB = new myCertPathBuilder(spi, defaultProvider, defaultType);
    assertEquals("Incorrect algorithm", certPB.getAlgorithm(), defaultType);
    assertEquals("Incorrect provider", certPB.getProvider(), defaultProvider);
    try {
        certPB.build(null);
        fail("CertPathBuilderException must be thrown ");
    } catch (CertPathBuilderException e) {
    }
    certPB = new myCertPathBuilder(null, null, null);
    assertNull("Incorrect algorithm", certPB.getAlgorithm());
    assertNull("Incorrect provider", certPB.getProvider());
    try {
        certPB.build(null);
        fail("NullPointerException must be thrown ");
    } catch (NullPointerException e) {
    }
}
Also used : MyCertPathBuilderSpi(org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi) CertPathBuilderSpi(java.security.cert.CertPathBuilderSpi) MyCertPathBuilderSpi(org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi) CertPathBuilderException(java.security.cert.CertPathBuilderException) CertPathBuilder(java.security.cert.CertPathBuilder)

Example 2 with MyCertPathBuilderSpi

use of org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi in project robovm by robovm.

the class CertPathBuilderSpiTest method testCertPathBuilderSpi01.

/**
     * Test for <code>CertPathBuilderSpi</code> constructor Assertion:
     * constructs CertPathBuilderSpi
     */
public void testCertPathBuilderSpi01() throws CertPathBuilderException, InvalidAlgorithmParameterException {
    CertPathBuilderSpi certPathBuilder = new MyCertPathBuilderSpi();
    CertPathParameters cpp = null;
    try {
        certPathBuilder.engineBuild(cpp);
        fail("CertPathBuilderException must be thrown");
    } catch (CertPathBuilderException e) {
    }
    CertPathBuilderResult cpbResult = certPathBuilder.engineBuild(cpp);
    assertNull("Not null CertPathBuilderResult", cpbResult);
}
Also used : MyCertPathBuilderSpi(org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi) CertPathBuilderSpi(java.security.cert.CertPathBuilderSpi) MyCertPathBuilderSpi(org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi) CertPathBuilderException(java.security.cert.CertPathBuilderException) CertPathBuilderResult(java.security.cert.CertPathBuilderResult) CertPathParameters(java.security.cert.CertPathParameters)

Aggregations

CertPathBuilderException (java.security.cert.CertPathBuilderException)2 CertPathBuilderSpi (java.security.cert.CertPathBuilderSpi)2 MyCertPathBuilderSpi (org.apache.harmony.security.tests.support.cert.MyCertPathBuilderSpi)2 CertPathBuilder (java.security.cert.CertPathBuilder)1 CertPathBuilderResult (java.security.cert.CertPathBuilderResult)1 CertPathParameters (java.security.cert.CertPathParameters)1