Skip to content

Instantly share code, notes, and snippets.

@slawekradzyminski
Created June 4, 2016 07:23
Show Gist options
  • Save slawekradzyminski/b45d3f7955482b04dbbbc5ad003b37b3 to your computer and use it in GitHub Desktop.
Save slawekradzyminski/b45d3f7955482b04dbbbc5ad003b37b3 to your computer and use it in GitHub Desktop.
private static final String EXPECTED_MD5 = "c3fb273e2843808968d68120121f2c74";
@Test
public void getDownloadPlusMd5() throws Exception {
Request request = prepareRequest();
File downloadedFile = request.downloadFile();
assertThat(calculateMd5(downloadedFile)).isEqualTo(EXPECTED_MD5);
}
private String calculateMd5(File downloadedFile) throws IOException {
FileInputStream fis = new FileInputStream(downloadedFile);
String md5 = md5Hex(fis);
fis.close();
return md5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment