### Question:
CRLCodec { public void writeCRL(X509CRL crl) throws IOException { String pem = getPEMEncodedString(crl); writeCRL(location.toAbsolutePath(), this.securityConfig.getCrlName(), pem, false); } 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 testWriteCRL() throws IOException, OperatorCreationException { 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); File crlFile = Paths.get(crlCodec.getLocation().toString(), this.securityConfig.getCrlName()).toFile(); assertTrue(crlFile.exists()); try (BufferedReader reader = new BufferedReader(new FileReader(crlFile))){ String header = reader.readLine(); assertEquals("-----BEGIN X509 CRL-----", header); String footer = null; String line = null; while ((line = reader.readLine()) != null) { footer = line; } assertEquals("-----END X509 CRL-----", footer); } }