File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
src/test/java/org/scijava/io/handle Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -89,4 +89,23 @@ public void testExists() throws IOException {
8989 // Clean up.
9090 assertTrue (nonExistentFile .delete ());
9191 }
92+
93+ @ Test
94+ public void testNotCreatedByClose () throws IOException {
95+ final Context ctx = new Context ();
96+ final DataHandleService dhs = ctx .service (DataHandleService .class );
97+
98+ final File nonExistentFile = //
99+ File .createTempFile ("FileHandleTest" , "nonexistent-file" );
100+ assertTrue (nonExistentFile .delete ());
101+ assertFalse (nonExistentFile .exists ());
102+
103+ final FileLocation loc = new FileLocation (nonExistentFile );
104+ final DataHandle <?> handle = dhs .create (loc );
105+ assertTrue (handle instanceof FileHandle );
106+ assertFalse (handle .exists ());
107+
108+ handle .close ();
109+ assertFalse (nonExistentFile .exists ());
110+ }
92111}
You can’t perform that action at this time.
0 commit comments