use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class CollectionCertStoreParametersTest method testCollectionCertStoreParametersCollection03.
/**
* Test #3 for <code>CollectionCertStoreParameters(Collection)</code>
* constructor<br>
*/
public final void testCollectionCertStoreParametersCollection03() {
Vector<Certificate> certificates = new Vector<Certificate>();
// create using empty collection
CollectionCertStoreParameters cp = new CollectionCertStoreParameters(certificates);
// check that the reference is used
assertTrue("isRefUsed_1", certificates == cp.getCollection());
// check that collection still empty
assertTrue("isEmpty", cp.getCollection().isEmpty());
// modify our collection
certificates.add(new MyCertificate("TEST", new byte[] { (byte) 1 }));
certificates.add(new MyCertificate("TEST", new byte[] { (byte) 2 }));
// check that internal state has been changed accordingly
assertTrue("isRefUsed_2", certificates.equals(cp.getCollection()));
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class KSTrustedCertificateEntryTest method testToString.
/**
* Test for <codfe>toString()</code> method
* Assertion: returns non null string
*/
public void testToString() {
Certificate cert = new MyCertificate("TEST", new byte[10]);
KeyStore.TrustedCertificateEntry ksTCE = new KeyStore.TrustedCertificateEntry(cert);
assertNotNull("toString() returns null string", ksTCE.toString());
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class KSTrustedCertificateEntryTest method testGetTrustedCertificate.
/**
* Test for <codfe>getTrustedCertificate()</code> method
* Assertion: returns trusted Certificate from goven entry
*/
public void testGetTrustedCertificate() {
Certificate cert = new MyCertificate("TEST", new byte[10]);
KeyStore.TrustedCertificateEntry ksTCE = new KeyStore.TrustedCertificateEntry(cert);
assertEquals("Incorrect certificate", cert, ksTCE.getTrustedCertificate());
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class KSPrivateKeyEntryTest method testPrivateKeyEntry01.
/**
* Test for <code>PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain)</code>
* constructor
* Assertion: throws NullPointerException when privateKey is null
*/
public void testPrivateKeyEntry01() {
//new Certificate[1];
Certificate[] certs = new MyCertificate[1];
PrivateKey pk = null;
try {
new KeyStore.PrivateKeyEntry(pk, certs);
fail("NullPointerException must be thrown when privateKey is null");
} catch (NullPointerException e) {
}
}
use of org.apache.harmony.security.tests.support.cert.MyCertificate in project robovm by robovm.
the class CollectionCertStoreParametersTest method testClone01.
/**
* Test #1 for <code>clone()</code> method<br>
*/
public final void testClone01() {
Vector<Certificate> certificates = new Vector<Certificate>();
certificates.add(new MyCertificate("TEST", new byte[] { (byte) 4 }));
CollectionCertStoreParameters cp1 = new CollectionCertStoreParameters(certificates);
CollectionCertStoreParameters cp2 = (CollectionCertStoreParameters) cp1.clone();
// check that that we have new object
assertTrue(cp1 != cp2);
}
Aggregations