assertThat(encode(injectHasher("SHA512").hash(mockAsset())), is(equalTo(SHA512_HASH)));
}
private static Asset mockAsset() throws Exception {
Asset asset = mock(Asset.class);
when(asset.openStream()).thenReturn(new ByteArrayInputStream(DATA.getBytes(Charsets.UTF_8)));
return asset;
}
private static String encode(byte[] hash) {
return BaseEncoding.base16().encode(hash).toLowerCase(Locale.ENGLISH);