コード例 #1
0
 @Test
 public void updateFile() throws Exception {
   final Method method = _utilsType.getDeclaredMethod(_methodName, File.class);
   final HashFunction function = newInstanceOf(_constructor);
   final File file = testFileOf("testFile1.txt");
   assertThat(method.invoke(null, file), is((Object) function.update(file)));
 }
コード例 #2
0
 @Test
 public void updateStringWithCharset() throws Exception {
   final Method method = _utilsType.getDeclaredMethod(_methodName, String.class, Charset.class);
   final HashFunction function = newInstanceOf(_constructor);
   assertThat(
       method.invoke(null, TEST_CONTENT_1, CHARSET),
       is((Object) function.update(TEST_CONTENT_1, CHARSET)));
 }
コード例 #3
0
 @Test
 public void updateByteRanges() throws Exception {
   final Method method =
       _utilsType.getDeclaredMethod(_methodName, byte[].class, int.class, int.class);
   final HashFunction function = newInstanceOf(_constructor);
   assertThat(
       method.invoke(null, TEST_BYTES_1, 1, 4), is((Object) function.update(TEST_BYTES_1, 1, 4)));
 }
コード例 #4
0
 @Test
 public void updateInputStream() throws Exception {
   final Method method = _utilsType.getDeclaredMethod(_methodName, InputStream.class);
   final HashFunction function = newInstanceOf(_constructor);
   try (final InputStream is1 = streamOf("testFile1.txt")) {
     try (final InputStream is2 = streamOf("testFile1.txt")) {
       assertThat(method.invoke(null, is1), is((Object) function.update(is2)));
     }
   }
 }
コード例 #5
0
 @Test
 public void updateByte() throws Exception {
   final Method method = _utilsType.getDeclaredMethod(_methodName, byte.class);
   final HashFunction function = newInstanceOf(_constructor);
   assertThat(method.invoke(null, (byte) 'X'), is((Object) function.update((byte) 'X')));
 }