  @Test
  public void fail_to_download() {

    when(fileHashes.of(any(File.class))).thenReturn("ABCDE");

    FileCache.Downloader downloader = new FileCache.Downloader() {
      public void download(String filename, File toFile) throws IOException {
        throw new IOException("fail");
      }
    };
    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Fail to download");
    cache.get("sonar-foo-plugin-1.5.jar", "ABCDE", downloader);
  }