### Question:
CRLCodec { public static X509CRL getX509CRL(X509CRLHolder holder) throws CRLException { return CRL_CONVERTER.getCRL(holder); } CRLCodec(SecurityConfig securityConfig); static X509CRL getX509CRL(X509CRLHolder holder); static String getPEMEncodedString(X509CRLHolder holder); static String getPEMEncodedString(X509CRL holder); static X509CRL getX509CRL(String pemEncodedString); Path getLocation(); void writeCRL(X509CRL crl); void writeCRL(X509CRLHolder crlHolder,
      String fileName, boolean overwrite); synchronized void writeCRL(Path basePath, String fileName,
      String pemCRLString, boolean force);  }### Answer:
@Test public void testGetX509CRL() throws IOException, OperatorCreationException, CertificateException, CRLException { X500Name issuer = x509CertificateHolder.getIssuer(); Date now = new Date(); X509v2CRLBuilder builder = new X509v2CRLBuilder(issuer, now); builder.addCRLEntry(x509CertificateHolder.getSerialNumber(), now, CRLReason.cACompromise); JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder(securityConfig.getSignatureAlgo()); contentSignerBuilder.setProvider(securityConfig.getProvider()); PrivateKey privateKey = keyPair.getPrivate(); X509CRLHolder cRLHolder = builder.build(contentSignerBuilder.build(privateKey)); CRLCodec crlCodec = new CRLCodec(securityConfig); crlCodec.writeCRL(cRLHolder, this.securityConfig.getCrlName(), true); X509CRLEntryHolder entryHolder = cRLHolder.getRevokedCertificate(BigInteger.ONE); assertNotNull(entryHolder); String pemEncodedString = crlCodec.getPEMEncodedString(cRLHolder); assertNotNull(pemEncodedString); String header = "-----BEGIN X509 CRL-----"; String footer = "-----END X509 CRL-----"; assertTrue(pemEncodedString.contains(header)); assertTrue(pemEncodedString.contains(footer)); }
@Test public void testGetX509CRLFromCRLHolder() throws IOException, OperatorCreationException, CertificateException, CRLException { X500Name issuer = x509CertificateHolder.getIssuer(); Date now = new Date(); X509v2CRLBuilder builder = new X509v2CRLBuilder(issuer, now); builder.addCRLEntry(x509CertificateHolder.getSerialNumber(), now, CRLReason.cACompromise); JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder(securityConfig.getSignatureAlgo()); contentSignerBuilder.setProvider(securityConfig.getProvider()); PrivateKey privateKey = keyPair.getPrivate(); X509CRLHolder cRLHolder = builder.build(contentSignerBuilder.build(privateKey)); CRLCodec crlCodec = new CRLCodec(securityConfig); X509CRL crl = crlCodec.getX509CRL(cRLHolder); assertNotNull(crl); }