@Test
public void testListObjectInfoCached() throws IOException {

  List<GoogleCloudStorageItemInfo> expected =
      Lists.newArrayList(ITEM_A_A, ITEM_A_AA, ITEM_A_ABA, ITEM_A_B);
  // First call to get the values in cache.
  gcs.listObjectInfo(BUCKET_A, /* objectNamePrefix= */ null, ListObjectOptions.DEFAULT_FLAT_LIST);
  // Second call to ensure the values are being served from cache.
  List<GoogleCloudStorageItemInfo> result =
      gcs.listObjectInfo(
          BUCKET_A, /* objectNamePrefix= */ null, ListObjectOptions.DEFAULT_FLAT_LIST);
  // Verify the delegate call once.
  verify(gcsDelegate, times(2))
      .listObjectInfo(
          eq(BUCKET_A),
          ArgumentMatchers.eq(null),
          ArgumentMatchers.eq(ListObjectOptions.DEFAULT_FLAT_LIST));
  // Verify the result.
  assertThat(result).containsExactlyElementsIn(expected);
  // Verify the state of the cache.
  assertThat(cache.getAllItemsRaw()).containsExactlyElementsIn(expected);
}