Skip to content

Commit eaa0eb4

Browse files
committed
DataHandleTest: use try-with-resources
1 parent b52332e commit eaa0eb4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/test/java/org/scijava/io/DataHandleTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ public void testDataHandle() throws IOException {
6464
context.service(DataHandleService.class);
6565

6666
final Location loc = createLocation();
67-
final DataHandle<? extends Location> handle = dataHandleService.create(loc);
68-
assertEquals(getExpectedHandleType(), handle.getClass());
67+
try (final DataHandle<? extends Location> handle = //
68+
dataHandleService.create(loc))
69+
{
70+
assertEquals(getExpectedHandleType(), handle.getClass());
6971

70-
checkReads(handle);
71-
checkWrites(handle);
72-
handle.close();
72+
checkReads(handle);
73+
checkWrites(handle);
74+
}
7375
}
7476

7577
// -- DataHandleTest methods --

0 commit comments

Comments
 (0)