use of java.security.cert.CertPathValidatorSpi in project robovm by robovm.
the class invalidParams method testCertPathValidator12.
/**
* Test for
* <code>CertPathValidator</code> constructor
* Assertion: returns CertPathValidator object
*/
public void testCertPathValidator12() throws CertificateException, NoSuchProviderException, NoSuchAlgorithmException, CertPathValidatorException, InvalidAlgorithmParameterException {
if (!PKIXSupport) {
fail(NotSupportMsg);
return;
}
CertPathValidatorSpi spi = new MyCertPathValidatorSpi();
CertPathValidator certPV = new myCertPathValidator(spi, defaultProvider, defaultType);
assertEquals("Incorrect algorithm", certPV.getAlgorithm(), defaultType);
assertEquals("Incorrect provider", certPV.getProvider(), defaultProvider);
certPV.validate(null, null);
try {
certPV.validate(null, null);
fail("CertPathValidatorException must be thrown");
} catch (CertPathValidatorException e) {
}
certPV = new myCertPathValidator(null, null, null);
assertNull("Incorrect algorithm", certPV.getAlgorithm());
assertNull("Incorrect provider", certPV.getProvider());
try {
certPV.validate(null, null);
fail("NullPointerException must be thrown");
} catch (NullPointerException e) {
}
}
use of java.security.cert.CertPathValidatorSpi in project robovm by robovm.
the class CertPathValidatorSpiTest method testCertPathValidatorSpi01.
/**
* Test for <code>CertPathValidatorSpi</code> constructor Assertion:
* constructs CertPathValidatorSpi
*/
public void testCertPathValidatorSpi01() throws CertPathValidatorException, InvalidAlgorithmParameterException {
CertPathValidatorSpi certPathValid = new MyCertPathValidatorSpi();
CertPathParameters params = null;
CertPath certPath = null;
CertPathValidatorResult cpvResult = certPathValid.engineValidate(certPath, params);
assertNull("Not null CertPathValidatorResult", cpvResult);
try {
certPathValid.engineValidate(certPath, params);
fail("CertPathValidatorException must be thrown");
} catch (CertPathValidatorException e) {
}
try {
certPathValid.engineValidate(certPath, params);
fail("InvalidAlgorithmParameterException must be thrown");
} catch (InvalidAlgorithmParameterException e) {
}
}
Aggregations