@Test public void diskLruCacheAsyncGet_whenEmpty_shouldReturnNull() throws Exception { CacheService.initialize(context); CacheService.getFromDiskCacheAsync(key1, diskCacheGetListener); semaphore.acquire(); assertThat(getKey).isEqualTo(key1); assertThat(getBytes).isNull(); }
@Test public void diskLruCacheAsyncGet_whenPopulated_shouldReturnValue() throws Exception { CacheService.initialize(context); assertCachesAreEmpty(); CacheService.putToDiskCache(key1, data1.getBytes()); CacheService.getFromDiskCacheAsync(key1, diskCacheGetListener); semaphore.acquire(); assertThat(getKey).isEqualTo(key1); assertThat(getBytes).isEqualTo(data1.getBytes()); }