Skip to content

Commit ba248b0

Browse files
Fix test
1 parent 1b8f3c2 commit ba248b0

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProviderTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ public void testDelete_dotDirNotNormalized_throwsIae() throws Exception {
412412

413413
@Test
414414
public void testDelete_trailingSlash() throws Exception {
415-
thrown.expect(CloudStoragePseudoDirectoryException.class);
416415
Files.delete(Paths.get(URI.create("gs://love/passion/")));
417416
}
418417

@@ -437,14 +436,19 @@ public void testDelete_notFound() throws Exception {
437436
public void testDeleteIfExists() throws Exception {
438437
Files.write(Paths.get(URI.create("gs://love/passionz")), "(✿◕ ‿◕ )ノ".getBytes(UTF_8));
439438
assertThat(Files.deleteIfExists(Paths.get(URI.create("gs://love/passionz")))).isTrue();
440-
}
441-
442-
public void testDeleteIfExists_trailingSlash() throws Exception {
443-
thrown.expect(CloudStoragePseudoDirectoryException.class);
439+
// call does not fail, the folder just doesn't exist
444440
Files.deleteIfExists(Paths.get(URI.create("gs://love/passion/")));
445441
}
446442

447443
@Test
444+
public void testDeleteIfExists_trailingSlash_disablePseudoDirectories() throws Exception {
445+
try (CloudStorageFileSystem fs = forBucket("doodle", usePseudoDirectories(false))) {
446+
// Doesn't exist, no error
447+
Files.deleteIfExists(Paths.get(URI.create("gs://love/passion/")));
448+
}
449+
}
450+
451+
@Test
448452
public void testCopy() throws Exception {
449453
Path source = Paths.get(URI.create("gs://military/fashion.show"));
450454
Path target = Paths.get(URI.create("gs://greenbean/adipose"));

0 commit comments

Comments
 (0)