/** engineGenerateCRL(InputStream inStream) method testing. */
  public void testEngineGenerateCRL() throws Exception {
    X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
    CRL crl;

    // DER encoded crt generation testing
    ByteArrayInputStream bais = new ByteArrayInputStream(CertFactoryTestData.getCRLEncoding());
    crl = certFactory.engineGenerateCRL(bais);
    assertNotNull("First generated CRL is null", crl);
    crl = certFactory.engineGenerateCRL(bais);
    assertNotNull("Second generated CRL is null", crl);

    try {
      certFactory.engineGenerateCRL(bais);
      fail("Expected CRLException was not thrown.");
    } catch (CRLException e) {
    }

    // Base64 testing
    bais = new ByteArrayInputStream(CertFactoryTestData.getBase64CRLEncoding());

    crl = certFactory.engineGenerateCRL(bais);
    assertNotNull("First generated CRL is null", crl);
    crl = certFactory.engineGenerateCRL(bais);
    assertNotNull("Second generated CRL is null", crl);

    try {
      certFactory.engineGenerateCRL(bais);
      fail("Expected CRLException was not thrown.");
    } catch (CRLException e) {
    }
  }
  /** engineGenerateCRLs(InputStream inStream) method testing. */
  public void testEngineGenerateCRLs() throws Exception {
    X509CertFactoryImpl certFactory = new X509CertFactoryImpl();

    // DER encoded crt generation testing
    ByteArrayInputStream bais = new ByteArrayInputStream(CertFactoryTestData.getCRLEncoding());
    assertEquals(
        "The size of collection is not correct", 2, certFactory.engineGenerateCRLs(bais).size());

    // Base64 testing
    bais = new ByteArrayInputStream(CertFactoryTestData.getBase64CRLEncoding());
    assertEquals(
        "The size of collection is not correct", 2, certFactory.engineGenerateCRLs(bais).size());
  }
  /** engineGenerateCertPath(InputStream inStream, String encoding) method testing. */
  public void testEngineGenerateCertPath1() throws Exception {
    X509CertFactoryImpl certFactory = new X509CertFactoryImpl();
    ByteArrayInputStream bais =
        new ByteArrayInputStream(CertFactoryTestData.getCertPathPKCS7Encoding());
    certFactory.engineGenerateCertPath(bais, "PKCS7");

    try {
      certFactory.engineGenerateCertPath(bais, "PKCS7");
      fail("Expected CertificateException was not thrown.");
    } catch (CertificateException e) {
    }
  }