/**
* engineGenerateCertificate(InputStream inStream) method testing.
*/
public void testEngineGenerateCertificate() throws Exception {
X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
Certificate cert;
// DER encoded certificate generation testing
ByteArrayInputStream bais =
new ByteArrayInputStream(
CertFactoryTestData.getCertEncoding());
cert = certFactory.engineGenerateCertificate(bais);
assertNotNull("First generated certificate is null", cert);
cert = certFactory.engineGenerateCertificate(bais);
assertNotNull("Second generated certificate is null", cert);
try {
certFactory.engineGenerateCertificate(bais);
fail("Expected CertificateException was not thrown.");
} catch (CertificateException e) {
}
// Base64 testing
bais = new ByteArrayInputStream(
CertFactoryTestData.getBase64CertEncoding());
cert = certFactory.engineGenerateCertificate(bais);
assertNotNull("First generated certificate is null", cert);
cert = certFactory.engineGenerateCertificate(bais);
assertNotNull("Second generated certificate is null", cert);
try {
certFactory.engineGenerateCertificate(bais);
fail("Expected CertificateException was not thrown.");
} catch (CertificateException e) {
}
}