|
24 | 24 | import com.google.common.testing.NullPointerTester; |
25 | 25 |
|
26 | 26 | import org.junit.Before; |
| 27 | +import org.junit.Rule; |
27 | 28 | import org.junit.Test; |
| 29 | +import org.junit.rules.ExpectedException; |
28 | 30 | import org.junit.runner.RunWith; |
29 | 31 | import org.junit.runners.JUnit4; |
30 | 32 |
|
@@ -58,6 +60,9 @@ public class CloudStorageFileSystemTest { |
58 | 60 | + "The Heart-ache, and the thousand Natural shocks\n" |
59 | 61 | + "That Flesh is heir to? 'Tis a consummation\n"; |
60 | 62 |
|
| 63 | + @Rule |
| 64 | + public ExpectedException thrown = ExpectedException.none(); |
| 65 | + |
61 | 66 | @Before |
62 | 67 | public void before() { |
63 | 68 | CloudStorageFileSystemProvider.setStorageOptions(LocalStorageHelper.getOptions()); |
@@ -204,8 +209,9 @@ public void testDeleteEmptyFolder() throws IOException { |
204 | 209 | } |
205 | 210 | } |
206 | 211 |
|
207 | | - @Test(expected = CloudStoragePseudoDirectoryException.class) |
| 212 | + @Test |
208 | 213 | public void testDeleteFullFolder() throws IOException { |
| 214 | + thrown.expect(CloudStoragePseudoDirectoryException.class); |
209 | 215 | try (FileSystem fs = CloudStorageFileSystem.forBucket("bucket")) { |
210 | 216 | Files.write(fs.getPath("dir/angel"), ALONE.getBytes(UTF_8)); |
211 | 217 | // we cannot delete existing folders if they contain something |
@@ -278,7 +284,7 @@ public void testDeleteRecursive() throws IOException { |
278 | 284 | * @param directory the directory to delete |
279 | 285 | * @throws IOException |
280 | 286 | */ |
281 | | - static private void deleteRecursive(Path directory) throws IOException { |
| 287 | + private static void deleteRecursive(Path directory) throws IOException { |
282 | 288 | Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { |
283 | 289 | @Override |
284 | 290 | public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { |
|
0 commit comments