### Question:
FileCertificateRepo implements CertificateRepo { public String getCertPath(X509Certificate cert, UseKeyWithType id) throws URISyntaxException { Applications application = null; String path = null; if (id != null) { application = Applications.fromUri(id.getApplication()); } if (application == Applications.SERVICE_ENDPOINT) { path = id.getIdentifier(); } else { path = cert.getSubjectDN().getName(); } path = convertIdForFileSystem(path) + ".cer"; return path; } FileCertificateRepo(String path); void saveCertificate(X509Certificate cert, UseKeyWithType id); void saveTrustedCACertificate(X509Certificate cert, UseKeyWithType id); void saveCACertificate(X509Certificate cert, UseKeyWithType id); void saveCRL(X509CRL crl, UseKeyWithType id); String convertIdForFileSystem(String dn); String getCertPath(X509Certificate cert, UseKeyWithType id); X509Certificate readCertificate(File certFile); X509CRL readCRL(File crlFile); @Override List<X509Certificate> getTrustedCaCerts(); @Override List<X509Certificate> getCaCerts(); @Override List<X509CRL> getCRLs(); @Override X509Certificate findByServiceName(String serviceName); @Override X509Certificate findByEndpoint(String endpoint); @Override X509Certificate findBySubjectDn(String subjectDn); @Override X509Certificate findByIssuerSerial(String issuer, String serial);  }### Answer:
@Test public void testGetCertPath() throws CertificateException, URISyntaxException, IOException { File storageDir = new File("target/teststore2"); storageDir.mkdirs(); FileCertificateRepo fileRegisterHandler = new FileCertificateRepo("target/teststore2"); InputStream is = this.getClass().getResourceAsStream("/store1/" + EXPECTED_CERT_FILE_NAME); if (is == null) { throw new RuntimeException("Can not find path " + is + " in classpath"); } X509Certificate cert = loadTestCert(is); UseKeyWithType key = new UseKeyWithType(); key.setApplication(Applications.SERVICE_ENDPOINT.getUri()); key.setIdentifier(EXAMPLE_SUBJECT_DN); String path = fileRegisterHandler.getCertPath(cert, key); assertEquals(EXPECTED_CERT_FILE_NAME, path); key.setIdentifier("../../../test.txt"); path = fileRegisterHandler.getCertPath(cert, key); assertEquals(".._.._.._test.txt.cer", path); }