@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))); }
@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))); }
@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))); }
@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))); } } }
@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'))); }