ConfluenceRestClient implements ConfluenceClient { @Override public ConfluencePage getPageWithContentAndVersionById(String contentId) { HttpGet pageByIdRequest = this.httpRequestFactory.getPageByIdRequest(contentId, "body.storage,version"); return sendRequestAndFailIfNot20x(pageByIdRequest, (response) -> { ConfluencePage confluencePage = extractConfluencePageWithContent(parseJsonResponse(response)); return confluencePage; }); } ConfluenceRestClient(String rootConfluenceUrl, boolean disableSslVerification, Double maxRequestsPerSecond, String username, String password);  ConfluenceRestClient(String rootConfluenceUrl, ProxyConfiguration proxyConfiguration, boolean disableSslVerification, Double maxRequestsPerSecond, String username, String password);  ConfluenceRestClient(String rootConfluenceUrl, CloseableHttpClient httpClient, Double maxRequestsPerSecond, String username, String password); @Override String addPageUnderAncestor(String spaceKey, String ancestorId, String title, String content, String versionMessage); @Override void updatePage(String contentId, String ancestorId, String title, String content, int newVersion, String versionMessage); @Override void deletePage(String contentId); @Override String getPageByTitle(String spaceKey, String title); @Override void addAttachment(String contentId, String attachmentFileName, InputStream attachmentContent); @Override void updateAttachmentContent(String contentId, String attachmentId, InputStream attachmentContent); @Override void deleteAttachment(String attachmentId); @Override ConfluenceAttachment getAttachmentByFileName(String contentId, String attachmentFileName); @Override ConfluencePage getPageWithContentAndVersionById(String contentId); @Override List<ConfluencePage> getChildPages(String contentId); @Override List<ConfluenceAttachment> getAttachments(String contentId); @Override void setPropertyByKey(String contentId, String key, String value); @Override String getPropertyByKey(String contentId, String key); @Override void deletePropertyByKey(String contentId, String key); @Override List<String> getLabels(String contentId); @Override void addLabels(String contentId, List<String> labels); @Override void deleteLabel(String contentId, String label);  }
@Test public void getPageById_withExistingContentId_returnsPageContent() throws Exception { String responseFilePath = "src/test/resources/org/sahli/asciidoc/confluence/publisher/client/http/page-content.json"; CloseableHttpClient httpClientMock = recordHttpClientForSingleResponseWithContentAndStatusCode(fileContent(responseFilePath, UTF_8), 200); ConfluenceRestClient confluenceRestClient = new ConfluenceRestClient(CONFLUENCE_ROOT_URL, httpClientMock, null, null, null); ConfluencePage confluencePage = confluenceRestClient.getPageWithContentAndVersionById("1234"); assertThat(confluencePage.getContentId(), is("1234")); assertThat(confluencePage.getTitle(), is("Some title")); assertThat(confluencePage.getContent(), is("Some content")); assertThat(confluencePage.getVersion(), is(1)); }