@Test public void testValueIsReadEveryTimeWhenCacheDisabled() { givenCacheValidity(0); when(loadFunction.apply(cacheKey)).thenReturn(true, false); RoleAuditFilterCache cache = new RoleAuditFilterCache(loadFunction, auditConfig); assertThat(cache.isWhitelisted(cacheKey)).isTrue(); assertThat(cache.isWhitelisted(cacheKey)).isFalse(); verify(loadFunction, times(2)).apply(cacheKey); }
public boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey) { try { return get(cacheKey); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } }
RoleAuditFilterCache extends AuthCache<RoleAuditFilterCacheKey, Boolean> { public boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey) { try { return get(cacheKey); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } }
RoleAuditFilterCache extends AuthCache<RoleAuditFilterCacheKey, Boolean> { public boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey) { try { return get(cacheKey); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } RoleAuditFilterCache(Function<RoleAuditFilterCacheKey, Boolean> loadFunction); @VisibleForTesting  RoleAuditFilterCache(Function<RoleAuditFilterCacheKey, Boolean> loadFunction, AuditConfig auditConfig); }
RoleAuditFilterCache extends AuthCache<RoleAuditFilterCacheKey, Boolean> { public boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey) { try { return get(cacheKey); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } RoleAuditFilterCache(Function<RoleAuditFilterCacheKey, Boolean> loadFunction); @VisibleForTesting  RoleAuditFilterCache(Function<RoleAuditFilterCacheKey, Boolean> loadFunction, AuditConfig auditConfig); boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey); }
RoleAuditFilterCache extends AuthCache<RoleAuditFilterCacheKey, Boolean> { public boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey) { try { return get(cacheKey); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } RoleAuditFilterCache(Function<RoleAuditFilterCacheKey, Boolean> loadFunction); @VisibleForTesting  RoleAuditFilterCache(Function<RoleAuditFilterCacheKey, Boolean> loadFunction, AuditConfig auditConfig); boolean isWhitelisted(RoleAuditFilterCacheKey cacheKey);  }