use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.
the class TimestampTest method testHashCode.
/*
* Class under test for String hashCode()
*/
public void testHashCode() {
Timestamp one = new Timestamp(now, cpath);
Timestamp two = new Timestamp(now, cpath);
Timestamp three = new Timestamp(now, new MyCertPath(new byte[] { 10, 20, 30 }));
Timestamp four = null;
assertTrue(one.hashCode() == two.hashCode());
assertTrue(one.hashCode() != three.hashCode());
assertTrue(two.hashCode() != three.hashCode());
try {
four.hashCode();
fail("NullPointerException expected");
} catch (NullPointerException e) {
// expected
}
}
use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testPKIXCertPathBuilderResult01.
//
// Tests
//
/**
* Test #1 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: Creates an instance of <code>PKIXCertPathBuilderResult</code>
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testPKIXCertPathBuilderResult01() 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, TestUtils.getPolicyTree(), testPublicKey);
assertTrue(r instanceof PKIXCertPathBuilderResult);
}
use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testPKIXCertPathBuilderResult04.
/**
* Test #4 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if trustAnchor is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult04() {
try {
// pass null
new PKIXCertPathBuilderResult(new MyCertPath(testEncoding), null, TestUtils.getPolicyTree(), testPublicKey);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testToString.
/**
* Test for <code>toString()</code> method<br>
* Assertion: the printable representation of this object
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testToString() 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, TestUtils.getPolicyTree(), testPublicKey);
assertNotNull(r.toString());
}
use of org.apache.harmony.security.tests.support.cert.MyCertPath in project robovm by robovm.
the class CertPathCertPathRepTest method testCertPathCertPathRep.
/**
* Test for <code>CertPath.CertPathRep(String type, byte[] data)</code>
* method<br>
*/
public final void testCertPathCertPathRep() {
MyCertPath cp = new MyCertPath(testEncoding);
MyCertPathRep rep = cp.new MyCertPathRep("MyEncoding", testEncoding);
assertEquals(testEncoding, rep.getData());
assertEquals("MyEncoding", rep.getType());
try {
cp.new MyCertPathRep(null, null);
} catch (Exception e) {
fail("Unexpected exeption " + e.getMessage());
}
}
Aggregations