use of org.phoenicis.tools.files.FileSizeUtilities in project POL-POM-5 by PlayOnLinux.
the class DownloaderTest method testGet_DownloadFile_FileIsDownloaded.
@Test
public void testGet_DownloadFile_FileIsDownloaded() throws Exception {
mockServer.when(request().withMethod("GET").withPath("/test.txt")).respond(response().withStatusCode(200).withHeaders(new Header("Content-Type", "application/config")).withBody("Content file to download"));
File temporaryFile = File.createTempFile("test", "txt");
temporaryFile.deleteOnExit();
new Downloader(new FileSizeUtilities()).get(mockServerURL, temporaryFile, e -> {
});
String fileContent = IOUtils.toString(new FileReader(temporaryFile));
assertEquals("Content file to download", fileContent);
}
use of org.phoenicis.tools.files.FileSizeUtilities in project POL-POM-5 by PlayOnLinux.
the class DownloaderTest method testGet_DownloadFileInAString_FileIsDownloaded.
@Test
public void testGet_DownloadFileInAString_FileIsDownloaded() throws Exception {
mockServer.when(request().withMethod("GET").withPath("/test2.txt")).respond(response().withStatusCode(200).withHeaders(new Header("Content-Type", "application/config")).withBody("Content file to download 2"));
String result = new Downloader(new FileSizeUtilities()).get(mockServerURLFile2, e -> {
});
assertEquals("Content file to download 2", result);
}
Aggregations