use of java.security.cert.PKIXCertPathBuilderResult in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testPKIXCertPathBuilderResult05.
/**
* Test #5 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if publicKey is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult05() {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
try {
// pass null
new PKIXCertPathBuilderResult(new MyCertPath(testEncoding), ta, TestUtils.getPolicyTree(), null);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
use of java.security.cert.PKIXCertPathBuilderResult in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testGetCertPath.
/**
* Test for <code>getCertPath()</code> method<br>
* Assertion: the built and validated <code>CertPath</code>
* (never <code>null</code>)
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testGetCertPath() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPath cp = new MyCertPath(testEncoding);
CertPathBuilderResult r = new PKIXCertPathBuilderResult(cp, ta, TestUtils.getPolicyTree(), testPublicKey);
// must return the same reference
// as passed to the constructor
assertSame(cp, r.getCertPath());
}
use of java.security.cert.PKIXCertPathBuilderResult in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method test_clone.
public final void test_clone() {
// Regression for HARMONY-2786.
TrustAnchor ta = TestUtils.getTrustAnchor();
assertNotNull(getName() + ": not performed (could not create test TrustAnchor)", ta);
PKIXCertPathBuilderResult init = new PKIXCertPathBuilderResult(new MyCertPath(testEncoding), ta, TestUtils.getPolicyTree(), testPublicKey);
PKIXCertPathBuilderResult clone = (PKIXCertPathBuilderResult) init.clone();
assertSame(init.getCertPath(), clone.getCertPath());
assertSame(init.getPolicyTree(), clone.getPolicyTree());
assertSame(init.getPublicKey(), clone.getPublicKey());
assertSame(init.getTrustAnchor(), clone.getTrustAnchor());
}
use of java.security.cert.PKIXCertPathBuilderResult in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testPKIXCertPathBuilderResult02.
/**
* Test #2 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: policy tree parameter may be <code>null</code>
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testPKIXCertPathBuilderResult02() throws InvalidKeySpecException, NoSuchAlgorithmException {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPathBuilderResult r = new PKIXCertPathBuilderResult(new MyCertPath(testEncoding), ta, null, testPublicKey);
assertTrue(r instanceof PKIXCertPathBuilderResult);
}
use of java.security.cert.PKIXCertPathBuilderResult in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testPKIXCertPathBuilderResult03.
/**
* Test #3 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if certPath is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult03() {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
try {
// pass null
new PKIXCertPathBuilderResult(null, ta, TestUtils.getPolicyTree(), testPublicKey);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
Aggregations