@Test
public void fromItemInfo() throws Exception {

  GoogleCloudStorageItemInfo itemInfo =
      new GoogleCloudStorageItemInfo(
          new StorageResourceId("foo-test-bucket", "bar/test/object"),
          /* creationTime= */ 10L,
          /* modificationTime= */ 15L,
          /* size= */ 200L,
          "us-east1",
          "nearline",
          "text/plain",
          /* contentEncoding= */ "lzma",
          /* metadata= */ ImmutableMap.of("foo-meta", new byte[] {5, 66, 56}),
          /* contentGeneration= */ 312432L,
          /* metaGeneration= */ 2L);
  FileInfo fileInfo = FileInfo.fromItemInfo(itemInfo);
  assertThat(fileInfo.getPath()).isEqualTo(new URI("gs://foo-test-bucket/bar/test/object"));
  assertThat(fileInfo.getCreationTime()).isEqualTo(10L);
  assertThat(fileInfo.getModificationTime()).isEqualTo(15L);
  assertThat(fileInfo.getSize()).isEqualTo(200);
  assertThat(fileInfo.getAttributes())
      .<byte[], byte[]>comparingValuesUsing(Correspondence.from(Arrays::equals, "Arrays.equals"))
      .containsExactly("foo-meta", new byte[] {5, 66, 56});
  assertThat(fileInfo.getItemInfo()).isEqualTo(itemInfo);
}