HttpRequestFactory { HttpDelete deleteAttachmentRequest(String attachmentId) { assertMandatoryParameter(isNotBlank(attachmentId), "attachmentId"); return new HttpDelete(this.confluenceRestApiEndpoint + "/content/" + attachmentId); } HttpRequestFactory(String rootConfluenceUrl); HttpGet getAttachmentsRequest(String contentId, Integer limit, Integer start, String expandOptions); HttpGet getAttachmentContentRequest(String relativeDownloadLink); HttpGet getPropertyByKeyRequest(String contentId, String key); HttpDelete deletePropertyByKeyRequest(String contentId, String key); HttpPost setPropertyByKeyRequest(String contentId, String key, String value);  }
@Test public void deleteAttachmentRequest_withValidParameters_returnsValidHttpDelete() { String attachmentId = "att1234"; HttpDelete deleteAttachmentRequest = this.httpRequestFactory.deleteAttachmentRequest(attachmentId); assertThat(deleteAttachmentRequest.getMethod(), is("DELETE")); assertThat(deleteAttachmentRequest.getURI().toString(), is(CONFLUENCE_REST_API_ENDPOINT + "/content/" + attachmentId)); }
@Test public void deleteAttachmentRequest_withEmptyAttachmentId_throwsIllegalArgumentException() { this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("attachmentId must be set"); this.httpRequestFactory.deleteAttachmentRequest(""); }