Account extends AcmeJsonResource { public void deactivate() throws AcmeException { LOG.debug("deactivate"); try (Connection conn = getSession().connect()) { JSONBuilder claims = new JSONBuilder(); claims.put(KEY_STATUS, "deactivated"); conn.sendSignedRequest(getLocation(), claims, getLogin()); setJSON(conn.readJsonResponse()); } } protected  Account(Login login); @Nullable Boolean getTermsOfServiceAgreed(); List<URI> getContacts(); Status getStatus(); boolean hasExternalAccountBinding(); @Nullable String getKeyIdentifier(); Iterator<Order> getOrders(); OrderBuilder newOrder(); Authorization preAuthorizeDomain(String domain); Authorization preAuthorize(Identifier identifier); void changeKey(KeyPair newKeyPair); void deactivate(); EditableAccount modify();  }
@Test public void testDeactivate() throws Exception { TestableConnectionProvider provider = new TestableConnectionProvider() { @Override public int sendSignedRequest(URL url, JSONBuilder claims, Login login) { JSON json = claims.toJSON(); assertThat(json.get("status").asString(), is("deactivated")); assertThat(url, is(locationUrl)); assertThat(login, is(notNullValue())); return HttpURLConnection.HTTP_OK; } @Override public JSON readJsonResponse() { return getJSON("deactivateAccountResponse"); } }; Account account = new Account(provider.createLogin()); account.deactivate(); assertThat(account.getStatus(), is(Status.DEACTIVATED)); provider.close(); }