Пример #1
0
 @Test
 public void testTtl() throws Exception {
   cachedCallable.call();
   cachedCallable.call();
   verify(inner, times(1)).call();
   mockTime.addMilliseconds(1001);
   when(inner.call()).thenReturn(CALL_RESULT + 1l);
   assertEquals((long) cachedCallable.call(), CALL_RESULT + 1l);
   verify(inner, times(2)).call();
 }
Пример #2
0
 @Test
 public void testCaching() throws Exception {
   cachedCallable.call();
   cachedCallable.call();
   verify(inner, times(1)).call();
 }
Пример #3
0
 @Test
 public void testCall() throws Exception {
   assertEquals((long) cachedCallable.call(), CALL_RESULT);
 }