use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathValidatorResultTest method testPKIXCertPathValidatorResult01.
//
// Tests
//
/**
* Test #1 for <code>PKIXCertPathValidatorResult(TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: creates an instance of
* <code>PKIXCertPathValidatorResult</code>
*
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testPKIXCertPathValidatorResult01() throws InvalidKeySpecException, NoSuchAlgorithmException {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
new PKIXCertPathValidatorResult(ta, TestUtils.getPolicyTree(), testPublicKey);
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathValidatorResultTest method testGetPolicyTree01.
/**
* Test for <code>getPolicyTree()</code> method<br>
* Assertion: returns the root node of the valid
* policy tree or <code>null</code> if there are
* no valid policies
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testGetPolicyTree01() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
// valid policy tree case;
PolicyNode pn = TestUtils.getPolicyTree();
PKIXCertPathValidatorResult vr = new PKIXCertPathValidatorResult(ta, pn, testPublicKey);
// must return the same reference passed
// as a parameter to the constructor
assertSame(pn, vr.getPolicyTree());
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathValidatorResultTest method testToString01.
/**
* Test #1 for <code>toString()</code> method<br>
* Assertion: Returns a formatted string describing this object
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testToString01() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
PKIXCertPathValidatorResult vr = new PKIXCertPathValidatorResult(ta, TestUtils.getPolicyTree(), testPublicKey);
assertNotNull(vr.toString());
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathValidatorResultTest method testGetPolicyTree02.
/**
* Test for <code>getPolicyTree()</code> method<br>
* Assertion: returns the root node of the valid
* policy tree or <code>null</code> if there are
* no valid policies
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testGetPolicyTree02() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
// no valid policy tree case (null)
PKIXCertPathValidatorResult vr = new PKIXCertPathValidatorResult(ta, null, testPublicKey);
// must return the same reference passed
// as a parameter to the constructor
assertNull(vr.getPolicyTree());
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathValidatorResultTest method testPKIXCertPathValidatorResult03.
/**
* Test #3 for <code>PKIXCertPathValidatorResult(TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code> if
* <code>PublicKey</code> parameter is <code>null</code>
*/
public final void testPKIXCertPathValidatorResult03() {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
try {
// pass null
new PKIXCertPathValidatorResult(ta, TestUtils.getPolicyTree(), null);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
Aggregations