### Question:
DefaultCAServer implements CertificateServer { @Override public void init(SecurityConfig securityConfig, CAType type) throws SCMSecurityException { caKeysPath = securityConfig.getKeyLocation(componentName); caRootX509Path = securityConfig.getCertificateLocation(componentName); this.config = securityConfig; profile = new DefaultProfile(); this.approver = new DefaultApprover(profile, this.config); if (type == CAType.SELF_SIGNED_CA) { VerificationStatus status = verifySelfSignedCA(securityConfig); Consumer<SecurityConfig> caInitializer = processVerificationStatus(status); caInitializer.accept(securityConfig); return; } LOG.error("We support only Self-Signed CAs for now."); throw new IllegalStateException("Not implemented functionality requested."); } DefaultCAServer(String subject, String clusterID, String scmID,
                         CertificateStore certificateStore); @Override void init(SecurityConfig securityConfig, CAType type); @Override X509CertificateHolder getCACertificate(); @Override X509Certificate getCertificate(String certSerialId); @Override Future<X509CertificateHolder> requestCertificate(
      PKCS10CertificationRequest csr,
      CertificateApprover.ApprovalType approverType); @Override Future<X509CertificateHolder> requestCertificate(String csr,
      CertificateApprover.ApprovalType type); @Override Future<Boolean> revokeCertificate(X509Certificate certificate,
      CertificateApprover.ApprovalType approverType);  }### Answer:
@Test public void testInit() throws SCMSecurityException, CertificateException, IOException { SecurityConfig securityConfig = new SecurityConfig(conf); CertificateServer testCA = new DefaultCAServer("testCA", RandomStringUtils.randomAlphabetic(4), RandomStringUtils.randomAlphabetic(4), caStore); testCA.init(securityConfig, CertificateServer.CAType.SELF_SIGNED_CA); X509CertificateHolder first = testCA.getCACertificate(); assertNotNull(first); testCA.init(securityConfig, CertificateServer.CAType.SELF_SIGNED_CA); X509CertificateHolder second = testCA.getCACertificate(); assertEquals(first, second); try { testCA.init(securityConfig, CertificateServer.CAType.INTERMEDIARY_CA); fail("code should not reach here, exception should have been thrown."); } catch (IllegalStateException e) { assertTrue(e.toString().contains("Not implemented")); } }