### Question:
CertificateManager { public String getCACertificateChainContent() { String serverCertDir = configs.getProperty(Configuration.SRVR_KSTR_DIR); String serverCertChainName = configs.getProperty(Configuration.SRVR_CRT_CHAIN_NAME); File certChainFile = new File(serverCertDir, serverCertChainName); if(certChainFile.exists()) { try { return new String(Files.readAllBytes(certChainFile.toPath())); } catch (IOException e) { LOG.error(e.getMessage()); } } String serverCertName = configs.getProperty(Configuration.SRVR_CRT_NAME); File certFile = new File(serverCertDir, serverCertName); if(certFile.canRead()) { try { return new String(Files.readAllBytes(certFile.toPath())); } catch (IOException e) { LOG.error(e.getMessage()); } } return null; }  void initRootCert(); String getCACertificateChainContent(); synchronized SignCertResponse signAgentCrt(String agentHostname, String agentCrtReqContent, String passphraseAgent);  }### Answer:
@Test public void testGetCACertificateChain() throws IOException { Injector injector = getInjector(); File directory = folder.newFolder(); String caCertFileName = "myca.crt"; String caCertChainFileName = "myca_chain.pem"; Configuration configuration = injector.getInstance(Configuration.class); expect(configuration.getProperty(Configuration.SRVR_KSTR_DIR)).andReturn(directory.getAbsolutePath()).anyTimes(); expect(configuration.getProperty(Configuration.SRVR_CRT_NAME)).andReturn(caCertFileName).anyTimes(); expect(configuration.getProperty(Configuration.SRVR_CRT_CHAIN_NAME)).andReturn(caCertChainFileName).anyTimes(); final File caCertFile = new File(directory, caCertFileName); final File caCertChainFile = new File(directory, caCertChainFileName); CertificateManager certificateManager = new CertificateManager(); injector.injectMembers(certificateManager); replayAll(); String content; Files.write(caCertFile.toPath(), Collections.singleton(caCertFile.getAbsolutePath())); content = certificateManager.getCACertificateChainContent(); Assert.assertEquals(caCertFile.getAbsolutePath(), content.trim()); Files.write(caCertChainFile.toPath(), Collections.singleton(caCertChainFile.getAbsolutePath())); content = certificateManager.getCACertificateChainContent(); Assert.assertEquals(caCertChainFile.getAbsolutePath(), content.trim()); verifyAll(); }