@Test public void downloadFileWritesTheFileToDisk() throws Exception { wireMockRule.stubFor(get(urlPathEqualTo(FILE_REQUEST)) .willReturn(aResponse().withStatus(HttpConstants.STATUS_OK) .withBody(TEST_CONTENT))); Path targetDirectory = temporaryFolder.newFolder("target").toPath(); Path resultFile = httpHelper.downloadFile(wireMockRule.url(FILE_REQUEST), targetDirectory).toPath(); checkDownloadedFile(targetDirectory, resultFile); }
public File downloadFile(String url, Path targetDirectory) throws IOException { String filename = url.substring(url.lastIndexOf("/") + 1); return downloadFile(url, targetDirectory, filename); }
HttpHelper { public File downloadFile(String url, Path targetDirectory) throws IOException { String filename = url.substring(url.lastIndexOf("/") + 1); return downloadFile(url, targetDirectory, filename); } }
HttpHelper { public File downloadFile(String url, Path targetDirectory) throws IOException { String filename = url.substring(url.lastIndexOf("/") + 1); return downloadFile(url, targetDirectory, filename); } HttpHelper(HttpClient httpClient); }
HttpHelper { public File downloadFile(String url, Path targetDirectory) throws IOException { String filename = url.substring(url.lastIndexOf("/") + 1); return downloadFile(url, targetDirectory, filename); } HttpHelper(HttpClient httpClient); File downloadFile(String url, Path targetDirectory); File downloadFile(String url, Path targetDirectory, String filename); }
HttpHelper { public File downloadFile(String url, Path targetDirectory) throws IOException { String filename = url.substring(url.lastIndexOf("/") + 1); return downloadFile(url, targetDirectory, filename); } HttpHelper(HttpClient httpClient); File downloadFile(String url, Path targetDirectory); File downloadFile(String url, Path targetDirectory, String filename);  }