Exemple #1
0
 @Test
 public void testAddToDictionary() throws UnsupportedEncodingException, NoSuchAlgorithmException {
   byte[] chunk1 = new byte[1024];
   String hash = testlocker.md5ToString(testlocker.md5(chunk1));
   testlocker.addToDictionary(hash, chunk1);
   Assert.assertTrue(testlocker.dictionary.contains(chunk1));
   Assert.assertTrue(testlocker.dictionary.containsKey(hash));
 }
Exemple #2
0
 @Test
 public void testcontentsMatch() throws UnsupportedEncodingException, NoSuchAlgorithmException {
   byte[] chunk2 = new byte[1024];
   String hash = testlocker.md5ToString(testlocker.md5(chunk2));
   String hash2 = hash + "false";
   testlocker.addToDictionary(hash, chunk2);
   Assert.assertTrue(testlocker.contentsMatch(hash, chunk2));
   Assert.assertFalse(testlocker.contentsMatch(hash2, chunk2));
 }