@Test(expected = IOException.class) public void downloadFileThrowsExceptionOn404StatusCode() throws Exception { wireMockRule.stubFor(get(anyUrl()) .willReturn(aResponse().withStatus(HttpConstants.STATUS_ERR_NOT_FOUND))); Path targetDirectory = temporaryFolder.newFolder("target").toPath(); httpHelper.downloadFile(wireMockRule.url("/test"), targetDirectory); }
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);  }