@Test
 void testToStorageMetadata() {
   assertNull(ToStorageMetadata.INSTANCE.apply(null));
   BlobStore blobStore = getBlobStore();
   blobStore.createContainerInLocation(null, "test");
   blobStore.createDirectory("test", "one");
   Set<StorageMetadata> storageMetadataSet =
       ImmutableSet.<StorageMetadata>builder()
           .addAll(transform(blobStore.list(), ToStorageMetadata.INSTANCE))
           .build();
   assertFalse(storageMetadataSet.isEmpty());
   StorageMetadata representation = storageMetadataSet.iterator().next();
   assertEquals("test", representation.getName());
 }
  @Test
  void testToBlob() {
    assertNull(ToBlob.INSTANCE.apply(null));
    BlobStore blobStore = getBlobStore();
    blobStore.createContainerInLocation(null, "container");
    blobStore.createDirectory("container", "one");

    blobStore.putBlob(
        "container",
        blobStore.blobBuilder("myblob").payload(ByteSource.wrap("testcontent".getBytes())).build());
    Blob representation = ToBlob.INSTANCE.apply(blobStore.getBlob("container", "myblob"));
    assertNotNull(representation);
    assertNotNull(representation.getBlobMetadata());
  }
  public void testDirectoryEndingWithSlash() throws InterruptedException {
    String containerName = getContainerName();
    try {
      BlobStore blobStore = view.getBlobStore();
      blobStore.createDirectory(containerName, "someDir");

      // According to the S3 documentation, a directory is nothing but a blob
      // whose name ends with a '/'. So let's try to remove the blob we just
      // created.
      blobStore.removeBlob(containerName, "someDir/");

      // The directory "someDir" shouldn't exist since we removed it. If this
      // test succeeds, it confirms that a directory (or folder) is nothing
      // but a blob with a name ending in '/'.
      assertEquals(blobStore.directoryExists(containerName, "someDir"), false);
    } finally {
      returnContainer(containerName);
    }
  }