@Test public void testGetDigest() throws FileNotFoundException, URISyntaxException, IOException, NoSuchAlgorithmException { boolean dataTested = false; for (File file : AllCoreTest .getFilesFromResourceDir(AllCoreTest.TEST_DATA_ROOT)) { JavaDigestValue apacheValue = JavaDigestValue.getInstance( DigestAlgorithm.SHA1, DigestUtils.sha(new FileInputStream(file))); JavaDigestValue testValue = JavaDigestValue.getInstance( DigestAlgorithm.SHA1, file); JavaDigestValue testSha256Value = JavaDigestValue.getInstance( DigestAlgorithm.SHA256, file); assertArrayEquals( "apacheValue.digest() and testValue.digest() should be equal", apacheValue.getDigest(), testValue.getDigest()); assertThat( "apacheValue.digest() and testSha256Value.digest() shouldn't be equal", apacheValue.getDigest(), IsNot.not(IsEqual.equalTo(testSha256Value.getDigest()))); dataTested = true; } assertTrue("No data tested as flag no set", dataTested); }
@Override public byte[] getDigest() { return DigestUtilities.hexStringToByteArray(this.hexDigest); }
JavaDigestValue implements DigestValue, Serializable { @Override public byte[] getDigest() { return DigestUtilities.hexStringToByteArray(this.hexDigest); } }
JavaDigestValue implements DigestValue, Serializable { @Override public byte[] getDigest() { return DigestUtilities.hexStringToByteArray(this.hexDigest); } JavaDigestValue();   JavaDigestValue(DigestAlgorithm algorithm, String hexDigest);   JavaDigestValue(DigestAlgorithm algorithm, byte[] digest); }
JavaDigestValue implements DigestValue, Serializable { @Override public byte[] getDigest() { return DigestUtilities.hexStringToByteArray(this.hexDigest); } JavaDigestValue();   JavaDigestValue(DigestAlgorithm algorithm, String hexDigest);   JavaDigestValue(DigestAlgorithm algorithm, byte[] digest); @Override URI getAlgorithmId(); @Override String getHexDigest(); @Override byte[] getDigest(); String toXml(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static JavaDigestValue getInstance(String xml); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			byte[] digest); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			String hexDigest); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			InputStream byteStream); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			File file); static Set<JavaDigestValue> createDigestSet(
			Set<DigestAlgorithm> algorithms, InputStream is); }
JavaDigestValue implements DigestValue, Serializable { @Override public byte[] getDigest() { return DigestUtilities.hexStringToByteArray(this.hexDigest); } JavaDigestValue();   JavaDigestValue(DigestAlgorithm algorithm, String hexDigest);   JavaDigestValue(DigestAlgorithm algorithm, byte[] digest); @Override URI getAlgorithmId(); @Override String getHexDigest(); @Override byte[] getDigest(); String toXml(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static JavaDigestValue getInstance(String xml); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			byte[] digest); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			String hexDigest); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			InputStream byteStream); static JavaDigestValue getInstance(DigestAlgorithm algorithm,
			File file); static Set<JavaDigestValue> createDigestSet(
			Set<DigestAlgorithm> algorithms, InputStream is);  }