### Question:
WebDownloader implements Downloader { @Override public File download(Archive archive) throws DownloadException { File target = archiveCache.getFile(archive); if (!target.exists()) { String url = archive.getUrl(); try { URL downloadLocation = new URL(url); LOGGER.info(DOWNLOADING, url); copyURLToFile(downloadLocation, target); if (target.length() <= 0) { throw new DownloadException(UNABLE_TO_DOWNLOAD+url); } } catch (IOException e) { throw new DownloadException(UNABLE_TO_DOWNLOAD+url, e); } } return target; } WebDownloader(ArchiveCache archiveCache); @Override File download(Archive archive);  }### Answer:
@Test public void shouldFailDueToMalformedUrl() throws Exception { when(archive.getUrl()).thenReturn("invalid-base-url"); assertThatThrownBy(() -> downloader.download(archive)).isInstanceOf(DownloadException.class); }