use of java.security.cert.CertificateFactorySpi in project robovm by robovm.
the class CertificateFactorySpiTest method testEngineGenerateCertPathLjava_io_InputStream02.
/**
* Test for <code>engineGenerateCertPath(InputStream)</code> method.
* Assertion: Generates a <code>CertPath</code> object and initializes it
* with the data read from the <code>InputStream</code>
*/
public void testEngineGenerateCertPathLjava_io_InputStream02() {
CertificateFactorySpi certFactorySpi = new extCertificateFactorySpi();
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
DataInputStream dis = new DataInputStream(bais);
try {
certFactorySpi.engineGenerateCertPath(dis);
fail("UnsupportedOperationException expected");
} catch (UnsupportedOperationException e) {
// expected
} catch (CertificateException e) {
fail("Unexpected CertificateException " + e.getMessage());
}
}
use of java.security.cert.CertificateFactorySpi in project robovm by robovm.
the class CertificateFactorySpiTest method testEngineGenerateCertPathLJava_util_List01.
/**
* Test for <code>engineGenerateCertPath(List<? extends Certificate>)</code>
* method Assertion: generates a <code>CertPath</code> object and
* initializes it with a <code>List</code> of <code>Certificates</code>
*/
public void testEngineGenerateCertPathLJava_util_List01() {
CertificateFactorySpi certFactorySpi = new MyCertificateFactorySpi();
MyCertificateFactorySpi.putMode(true);
List<Certificate> list = new ArrayList<Certificate>();
try {
assertNull(certFactorySpi.engineGenerateCertPath(list));
} catch (CertificateException e) {
fail("Unexpected CertificateException " + e.getMessage());
}
try {
certFactorySpi.engineGenerateCertPath((List<? extends Certificate>) null);
fail("expected NullPointerException");
} catch (NullPointerException e) {
// ok
} catch (CertificateException e) {
fail("Unexpected CertificateException " + e.getMessage());
}
}
use of java.security.cert.CertificateFactorySpi in project robovm by robovm.
the class CertificateFactorySpiTest method testEngineGenerateCertPathLjava_io_InputStream_Ljava_lang_String01.
/**
* Test for <code>engineGenerateCertPath(InputStream, String)</code>
* method. Assertion: generates a <code>CertPath</code> object and
* initializes it with the data read from the <code>InputStream</code>
*/
public void testEngineGenerateCertPathLjava_io_InputStream_Ljava_lang_String01() {
CertificateFactorySpi certFactorySpi = new MyCertificateFactorySpi();
MyCertificateFactorySpi.putMode(true);
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
DataInputStream dis = new DataInputStream(bais);
try {
certFactorySpi.engineGenerateCertPath(dis, "");
fail("IllegalArgumentException expected");
} catch (IllegalArgumentException e) {
// expected
} catch (CertificateException e) {
fail("Unexpected CertificateException " + e.getMessage());
}
try {
assertNull(certFactorySpi.engineGenerateCertPath(dis, "encoding"));
} catch (CertificateException e) {
fail("Unexpected CertificateException " + e.getMessage());
}
}
use of java.security.cert.CertificateFactorySpi in project robovm by robovm.
the class CertificateFactorySpiTest method testAbstractMethods.
public void testAbstractMethods() {
CertificateFactorySpi certFactorySpi = new extCertificateFactorySpi();
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[3]);
DataInputStream dis = new DataInputStream(bais);
try {
certFactorySpi.engineGenerateCRL(dis);
certFactorySpi.engineGenerateCRLs(dis);
certFactorySpi.engineGenerateCertificate(dis);
certFactorySpi.engineGenerateCertificates(dis);
} catch (Exception e) {
fail("Unexpected exception " + e.getMessage());
}
}
use of java.security.cert.CertificateFactorySpi in project robovm by robovm.
the class CertificateFactorySpiTest method testEngineGenerateCertPathLjava_io_InputStream_Ljava_lang_String02.
/**
* Test for <code>engineGenerateCertPath(InputStream, String)</code>
* method. Assertion: generates a <code>CertPath</code> object and
* initializes it with the data read from the <code>InputStream</code>
*/
public void testEngineGenerateCertPathLjava_io_InputStream_Ljava_lang_String02() {
CertificateFactorySpi certFactorySpi = new extCertificateFactorySpi();
ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
DataInputStream dis = new DataInputStream(bais);
try {
certFactorySpi.engineGenerateCertPath(dis, "encoding");
fail("UnsupportedOperationException expected");
} catch (UnsupportedOperationException e) {
// expected
} catch (CertificateException e) {
fail("Unexpected CertificateException " + e.getMessage());
}
}
Aggregations