Skip to content

Commit 05b8bee

Browse files
Apply reviewer comments
1 parent 2a218c2 commit 05b8bee

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import com.google.common.testing.NullPointerTester;
2525

2626
import org.junit.Before;
27+
import org.junit.Rule;
2728
import org.junit.Test;
29+
import org.junit.rules.ExpectedException;
2830
import org.junit.runner.RunWith;
2931
import org.junit.runners.JUnit4;
3032

@@ -58,6 +60,9 @@ public class CloudStorageFileSystemTest {
5860
+ "The Heart-ache, and the thousand Natural shocks\n"
5961
+ "That Flesh is heir to? 'Tis a consummation\n";
6062

63+
@Rule
64+
public ExpectedException thrown = ExpectedException.none();
65+
6166
@Before
6267
public void before() {
6368
CloudStorageFileSystemProvider.setStorageOptions(LocalStorageHelper.getOptions());
@@ -204,8 +209,9 @@ public void testDeleteEmptyFolder() throws IOException {
204209
}
205210
}
206211

207-
@Test(expected = CloudStoragePseudoDirectoryException.class)
212+
@Test
208213
public void testDeleteFullFolder() throws IOException {
214+
thrown.expect(CloudStoragePseudoDirectoryException.class);
209215
try (FileSystem fs = CloudStorageFileSystem.forBucket("bucket")) {
210216
Files.write(fs.getPath("dir/angel"), ALONE.getBytes(UTF_8));
211217
// we cannot delete existing folders if they contain something
@@ -278,7 +284,7 @@ public void testDeleteRecursive() throws IOException {
278284
* @param directory the directory to delete
279285
* @throws IOException
280286
*/
281-
static private void deleteRecursive(Path directory) throws IOException {
287+
private static void deleteRecursive(Path directory) throws IOException {
282288
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
283289
@Override
284290
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ public void testDeleteRecursive() throws IOException {
373373
assertThat(Files.exists(fs.getPath("playwrights/French/Corneille"))).isFalse();
374374
assertThat(Files.exists(fs.getPath("Racine"))).isTrue();
375375
Files.deleteIfExists(fs.getPath("Racine"));
376+
assertThat(Files.exists(fs.getPath("Racine"))).isFalse();
376377
}
377378
}
378379

@@ -381,7 +382,7 @@ public void testDeleteRecursive() throws IOException {
381382
* @param directory the directory to delete
382383
* @throws IOException
383384
*/
384-
static private void deleteRecursive(Path directory) throws IOException {
385+
private static void deleteRecursive(Path directory) throws IOException {
385386
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
386387
@Override
387388
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {

0 commit comments

Comments
 (0)