diff options
author | Colin Decker <cgdecker@gmail.com> | 2018-01-05 14:45:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-05 14:45:04 -0500 |
commit | a89928c001b2c98db356d5d226bd45dd1e369c64 (patch) | |
tree | e0368f1a9693fd91706c5ce5d2393f73c7132f83 | |
parent | 1a432be17f5d5f6b8e96adb11b5280c6d2009a96 (diff) | |
parent | 04300a3bf944f44c9968ee7ab3280097d90ff531 (diff) | |
download | jimfs-a89928c001b2c98db356d5d226bd45dd1e369c64.tar.gz |
Merge pull request #59 from google/sync-master-2018/01/05
Moe sync
-rw-r--r-- | jimfs/src/test/java/com/google/common/jimfs/JimfsFileSystemCloseTest.java | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/jimfs/src/test/java/com/google/common/jimfs/JimfsFileSystemCloseTest.java b/jimfs/src/test/java/com/google/common/jimfs/JimfsFileSystemCloseTest.java index 0ac657a..2e05714 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/JimfsFileSystemCloseTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/JimfsFileSystemCloseTest.java @@ -30,11 +30,6 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -55,6 +50,9 @@ import java.nio.file.WatchService; import java.nio.file.attribute.BasicFileAttributeView; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileTime; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; /** * Tests for what happens when a file system is closed. @@ -154,14 +152,15 @@ public class JimfsFileSystemCloseTest { Path p = fs.getPath("/foo"); Files.createDirectory(p); - DirectoryStream<Path> stream = Files.newDirectoryStream(p); + try (DirectoryStream<Path> stream = Files.newDirectoryStream(p)) { - fs.close(); + fs.close(); - try { - stream.iterator(); - fail(); - } catch (ClosedDirectoryStreamException expected) { + try { + stream.iterator(); + fail(); + } catch (ClosedDirectoryStreamException expected) { + } } } |