@Test public void updatePageRequest_withEmptyTitle_throwsIllegalArgumentException() { this.expectedException.expect(IllegalArgumentException.class); this.expectedException.expectMessage("title must be set"); this.httpRequestFactory.updatePageRequest("1234", "1", "", "content", 2, "test message"); }
HttpPut updatePageRequest(String contentId, String ancestorId, String title, String content, int newVersion, String versionMessage) { assertMandatoryParameter(isNotBlank(contentId), "contentId"); assertMandatoryParameter(isNotBlank(title), "title"); PagePayload pagePayload = pagePayloadBuilder() .ancestorId(ancestorId) .title(title) .content(content) .version(newVersion) .versionMessage(versionMessage) .build(); HttpPut updatePageRequest = new HttpPut(this.confluenceRestApiEndpoint + "/content/" + contentId); updatePageRequest.setEntity(httpEntityWithJsonPayload(pagePayload)); updatePageRequest.addHeader(APPLICATION_JSON_UTF8_HEADER); return updatePageRequest; }
HttpRequestFactory { HttpPut updatePageRequest(String contentId, String ancestorId, String title, String content, int newVersion, String versionMessage) { assertMandatoryParameter(isNotBlank(contentId), "contentId"); assertMandatoryParameter(isNotBlank(title), "title"); PagePayload pagePayload = pagePayloadBuilder() .ancestorId(ancestorId) .title(title) .content(content) .version(newVersion) .versionMessage(versionMessage) .build(); HttpPut updatePageRequest = new HttpPut(this.confluenceRestApiEndpoint + "/content/" + contentId); updatePageRequest.setEntity(httpEntityWithJsonPayload(pagePayload)); updatePageRequest.addHeader(APPLICATION_JSON_UTF8_HEADER); return updatePageRequest; } }
HttpRequestFactory { HttpPut updatePageRequest(String contentId, String ancestorId, String title, String content, int newVersion, String versionMessage) { assertMandatoryParameter(isNotBlank(contentId), "contentId"); assertMandatoryParameter(isNotBlank(title), "title"); PagePayload pagePayload = pagePayloadBuilder() .ancestorId(ancestorId) .title(title) .content(content) .version(newVersion) .versionMessage(versionMessage) .build(); HttpPut updatePageRequest = new HttpPut(this.confluenceRestApiEndpoint + "/content/" + contentId); updatePageRequest.setEntity(httpEntityWithJsonPayload(pagePayload)); updatePageRequest.addHeader(APPLICATION_JSON_UTF8_HEADER); return updatePageRequest; } HttpRequestFactory(String rootConfluenceUrl); }
HttpRequestFactory { HttpPut updatePageRequest(String contentId, String ancestorId, String title, String content, int newVersion, String versionMessage) { assertMandatoryParameter(isNotBlank(contentId), "contentId"); assertMandatoryParameter(isNotBlank(title), "title"); PagePayload pagePayload = pagePayloadBuilder() .ancestorId(ancestorId) .title(title) .content(content) .version(newVersion) .versionMessage(versionMessage) .build(); HttpPut updatePageRequest = new HttpPut(this.confluenceRestApiEndpoint + "/content/" + contentId); updatePageRequest.setEntity(httpEntityWithJsonPayload(pagePayload)); updatePageRequest.addHeader(APPLICATION_JSON_UTF8_HEADER); return updatePageRequest; } 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); }
HttpRequestFactory { HttpPut updatePageRequest(String contentId, String ancestorId, String title, String content, int newVersion, String versionMessage) { assertMandatoryParameter(isNotBlank(contentId), "contentId"); assertMandatoryParameter(isNotBlank(title), "title"); PagePayload pagePayload = pagePayloadBuilder() .ancestorId(ancestorId) .title(title) .content(content) .version(newVersion) .versionMessage(versionMessage) .build(); HttpPut updatePageRequest = new HttpPut(this.confluenceRestApiEndpoint + "/content/" + contentId); updatePageRequest.setEntity(httpEntityWithJsonPayload(pagePayload)); updatePageRequest.addHeader(APPLICATION_JSON_UTF8_HEADER); return updatePageRequest; } 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);  }