AnalyticsCacheSettings { public boolean isProgressiveCachingEnabled() { final AnalyticsCacheTtlMode analyticsCacheMode = (AnalyticsCacheTtlMode) systemSettingManager .getSystemSetting( ANALYTICS_CACHE_TTL_MODE ); return PROGRESSIVE == analyticsCacheMode; } AnalyticsCacheSettings( final SystemSettingManager systemSettingManager ); boolean isProgressiveCachingEnabled(); boolean isFixedCachingEnabled(); long progressiveExpirationTimeOrDefault( final Date dateBeforeToday ); long fixedExpirationTimeOrDefault(); boolean isCachingEnabled();  }
@Test public void testWhenProgressiveCachingIsEnabled() { final AnalyticsCacheTtlMode progressiveCacheTtlMode = PROGRESSIVE; final CacheStrategy anyTimeoutStrategy = CACHE_1_MINUTE; when( systemSettingManager.getSystemSetting( ANALYTICS_CACHE_TTL_MODE ) ).thenReturn( progressiveCacheTtlMode ); when( systemSettingManager.getSystemSetting( CACHE_STRATEGY ) ).thenReturn( anyTimeoutStrategy ); final boolean progressiveCacheFlag = analyticsCacheSettings.isProgressiveCachingEnabled(); assertThat( progressiveCacheFlag, is( true ) ); }
@Test public void testWhenProgressiveCachingIsEnabledButStrategyIsNoCache() { final AnalyticsCacheTtlMode progressiveCacheTtlMode = PROGRESSIVE; final CacheStrategy anyTimeoutStrategy = NO_CACHE; when( systemSettingManager.getSystemSetting( ANALYTICS_CACHE_TTL_MODE ) ).thenReturn( progressiveCacheTtlMode ); when( systemSettingManager.getSystemSetting( CACHE_STRATEGY ) ).thenReturn( anyTimeoutStrategy ); final boolean progressiveCacheFlag = analyticsCacheSettings.isProgressiveCachingEnabled(); assertThat( progressiveCacheFlag, is( true ) ); }