/**
*
*/
@Test
@SuppressWarnings(CompilerWarnings.UNCHECKED)
public void shouldWrapRuntimeExceptionInMemoizationException() {
// given
final DoubleFunction<String> keyfunction = a -> "key";
try (final Cache<String, Integer> cache = Mockito.mock(Cache.class)) {
final JCacheBasedDoubleToIntFunctionMemoizer<String> loader = new JCacheBasedDoubleToIntFunctionMemoizer<>(
cache, keyfunction, null);
given(cache.invoke(any(), any())).willThrow(RuntimeException.class);
// when
thrown.expect(MemoizationException.class);
// then
loader.applyAsInt(123);
}
}
JCacheBasedDoubleToIntFunctionMemoizerTest.java 文件源码
java
阅读 47
收藏 0
点赞 0
评论 0
项目:memoization.java
作者:
评论列表
文章目录