### Question:
AcmeClientSpi { public X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames) throws AcmeException { return obtainCertificateChain(account, staging, null, -1, domainNames); }  Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging); AcmeMetadata getMetadata(AcmeAccount account, boolean staging); boolean createAccount(AcmeAccount account, boolean staging); boolean createAccount(AcmeAccount account, boolean staging, boolean onlyReturnExisting); void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed); void updateAccount(AcmeAccount account, boolean staging, String[] contactUrls); void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls); void changeAccountKey(AcmeAccount account, boolean staging); void changeAccountKey(AcmeAccount account, boolean staging, X509Certificate certificate, PrivateKey privateKey); void deactivateAccount(AcmeAccount account, boolean staging); X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames); X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String keyAlgorithmName, int keySize,
                                                                    String... domainNames); String createAuthorization(AcmeAccount account, boolean staging, String domainName); void deactivateAuthorization(AcmeAccount account, boolean staging, String authorizationUrl); abstract AcmeChallenge proveIdentifierControl(AcmeAccount account, List<AcmeChallenge> challenges); abstract void cleanupAfterChallenge(AcmeAccount account, AcmeChallenge challenge); void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate); void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate, CRLReason reason); byte[] getNewNonce(final AcmeAccount account, final boolean staging); static final int DEFAULT_EC_KEY_SIZE; static final int DEFAULT_KEY_SIZE; static final String DEFAULT_KEY_ALGORITHM_NAME; }### Answer:
@Test public void testObtainCertificateChain() throws Exception { server = setupTestObtainCertificate(); AcmeAccount account = populateAccount(ACCOUNT_3_V2); String domainName = "fjsljghasldfjgkv2.com"; obtainCertificateChain(null, -1, account, domainName); }
@Test public void testObtainCertificateChainMissingLocationURL() throws Exception { server = setupTestObtainCertificate(true); AcmeAccount account = populateAccount(ACCOUNT_3_V2); String domainName = "fjsljghasldfjgkv2.com"; try { obtainCertificateChain(null, -1, account, domainName); fail("Expected AcmeException not thrown"); } catch(AcmeException e) { assertTrue(e.getMessage().contains(ORDER)); } }
@Test public void testObtainCertificateChainWithKeySize() throws Exception { server = setupTestObtainCertificateWithKeySize(); AcmeAccount account = populateAccount(ACCOUNT_6_V2); String domainName = "inlneseppwkfwewv2.com"; obtainCertificateChain("RSA", 4096, account, domainName); }
@Test public void testObtainCertificateChainWithECPublicKey() throws Exception { server = setupTestObtainCertificateWithECPublicKey(); AcmeAccount account = populateAccount(ACCOUNT_7_V2); String domainName = "mndelkdnbcilohgv2.com"; obtainCertificateChain("EC", 256, account, domainName); }
@Test public void testObtainCertificateChainWithUnsupportedPublicKey() throws Exception { try { server = setupTestObtainCertificateWithUnsupportedPublicKey(); AcmeAccount account = populateAccount(ACCOUNT_7_V2); String domainName = "iraclzlcqgaymrc.com"; obtainCertificateChain("DSA", 2048, account, domainName); fail("Expected AcmeException not thrown"); } catch (AcmeException expected) { } }