@Test
public void testGetItemInfosSomeCached() throws IOException {

  List<StorageResourceId> requestedIds =
      Lists.newArrayList(
          ITEM_A_A.getResourceId(), // Not cached
          ITEM_A_B.getResourceId(), // Cached
          ITEM_B_A.getResourceId(), // Not cached
          ITEM_B_B.getResourceId()); // Cached
  List<StorageResourceId> uncachedIds =
      Lists.newArrayList(ITEM_A_A.getResourceId(), ITEM_B_A.getResourceId());
  List<GoogleCloudStorageItemInfo> expected =
      Lists.newArrayList(ITEM_A_A, ITEM_A_B, ITEM_B_A, ITEM_B_B);
  // Prepare the cache.
  cache.putItem(ITEM_A_B);
  cache.putItem(ITEM_B_B);
  List<GoogleCloudStorageItemInfo> result = gcs.getItemInfos(requestedIds);
  // Verify the delegate call.
  verify(gcsDelegate).getItemInfos(eq(uncachedIds));
  // Verify the result and its ordering.
  assertThat(result).containsExactlyElementsIn(expected).inOrder();
  // Verify the state of the cache.
  assertThat(cache.getAllItemsRaw()).containsExactlyElementsIn(expected);
}