Skip to content

Commit

Permalink
fix typo and add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jixinchi committed Nov 14, 2023
1 parent 5069720 commit acb3f61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ private SortedSet<StorageMetadata> extractCommonPrefixes(SortedSet<StorageMetada
if (!contents.contains(md)) {
contents.add(md);
}
contents.add(md);
}
return contents;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,22 @@ public void testListBlobEndsWithDelimiter() {
assertThat(Iterables.get(results, 0).getType()).isNotEqualTo(StorageType.RELATIVE_PATH);
}

public void testListBlobEndsWithDelimiterAndDelimiterFilter() {
String containerName = "testListBlobEndsWithDelimiterAndDelimiterFilter";
blobStore.createContainerInLocation(null, containerName);
blobStore.putBlob(containerName, blobStore.blobBuilder("foo/").type(StorageType.FOLDER)
.payload(ByteSource.empty()).build());
blobStore.putBlob(containerName, blobStore.blobBuilder("bar/text").type(StorageType.BLOB)
.payload(ByteSource.empty()).build());
PageSet<? extends StorageMetadata> results = blobStore.list(containerName,
ListContainerOptions.Builder.delimiter("/"));
assertThat(results.size()).isEqualTo(2);
assertThat(Iterables.get(results, 0).getName()).isEqualTo("bar/");
assertThat(Iterables.get(results, 0).getType()).isEqualTo(StorageType.RELATIVE_PATH);
assertThat(Iterables.get(results, 1).getName()).isEqualTo("foo/");
assertThat(Iterables.get(results, 1).getType()).isEqualTo(StorageType.FOLDER);
}

public void testDirectoryListing() {
String containerName = "testDirectoryListing";
blobStore.createContainerInLocation(null, containerName);
Expand Down

0 comments on commit acb3f61

Please sign in to comment.