private String verifyListenerOnWriteSuccessAndGetResourceId(CacheKey key, long itemSize) {
    ArgumentCaptor<CacheEvent> cacheEventCaptor = ArgumentCaptor.forClass(CacheEvent.class);
    mCacheEventListenerInOrder
        .verify(mCacheEventListener)
        .onWriteSuccess(cacheEventCaptor.capture());

    CacheEvent cacheEvent = cacheEventCaptor.getValue();
    CacheEventAssert.assertThat(cacheEvent)
        .isNotNull()
        .hasCacheKey(key)
        .hasItemSize(itemSize)
        .hasResourceIdSet();

    return cacheEvent.getResourceId();
  }
Verify that multiple threads can write to the cache at the same time.
imagepipeline-base/src/test/java/com/facebook/cache/disk/DiskStorageCacheTest.java