HttpRequestFactory { public HttpGet getAttachmentContentRequest(String relativeDownloadLink) { assertMandatoryParameter(isNotBlank(relativeDownloadLink), "relativeDownloadLink"); return new HttpGet(this.rootConfluenceUrl + relativeDownloadLink); } 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 getAttachmentContentRequest_withValidParameters_returnsHttpGetRequest() { String relativeDownloadLink = "/download/attachment.txt"; HttpGet getAttachmentContentRequest = this.httpRequestFactory.getAttachmentContentRequest(relativeDownloadLink); assertThat(getAttachmentContentRequest.getURI().toString(), is(ROOT_CONFLUENCE_URL + relativeDownloadLink)); }
@Test public void getAttachmentContentRequest_withBlankRelativeDownloadLink_throwsIllegalArgumentException() { this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("relativeDownloadLink must be set"); this.httpRequestFactory.getAttachmentContentRequest(""); }