File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
src/test/java/org/scijava/io/handle Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -79,17 +79,18 @@ public void testExists() throws IOException {
7979 final boolean deleted = delete (nonExistentFile );
8080
8181 final FileLocation loc = new FileLocation (nonExistentFile );
82- final DataHandle <?> handle = dhs .create (loc );
83- assertTrue (handle instanceof FileHandle );
84- if (deleted ) {
85- assertFalse (handle .exists ());
86- assertEquals (-1 , handle .length ());
82+ try (final DataHandle <?> handle = dhs .create (loc )) {
83+ assertTrue (handle instanceof FileHandle );
84+ if (deleted ) {
85+ assertFalse (handle .exists ());
86+ assertEquals (-1 , handle .length ());
87+ }
88+
89+ handle .writeBoolean (true );
90+ assertTrue (handle .exists ());
91+ assertEquals (1 , handle .length ());
8792 }
8893
89- handle .writeBoolean (true );
90- assertTrue (handle .exists ());
91- assertEquals (1 , handle .length ());
92-
9394 // Clean up.
9495 delete (nonExistentFile );
9596 }
You can’t perform that action at this time.
0 commit comments