示例#1
0
  @Test
  public void initializeCache_withValidContext_shouldCreateNewCachesIdempotently()
      throws Exception {
    assertThat(CacheService.getDiskLruCache()).isNull();

    CacheService.initialize(context);
    DiskLruCache diskLruCache = CacheService.getDiskLruCache();
    assertThat(diskLruCache).isNotNull();

    CacheService.initialize(context);
    assertThat(diskLruCache).isEqualTo(CacheService.getDiskLruCache());
  }
示例#2
0
 public static void assertDiskCacheIsEmpty() {
   assertThat(CacheService.getDiskLruCache()).isNotNull();
   assertThat(CacheService.getDiskLruCache().size()).isEqualTo(0);
 }
示例#3
0
 public static void assertDiskCacheIsUninitialized() {
   assertThat(CacheService.getDiskLruCache()).isNull();
 }