Close byte channel created by newByteChannelReturnsByteChannel

See gh-7161
This commit is contained in:
Andy Wilkinson 2023-10-20 11:22:16 +01:00
parent dad5dc6750
commit 88bf3dfba2
1 changed files with 3 additions and 2 deletions

View File

@ -137,8 +137,9 @@ class NestedFileSystemProviderTests {
void newByteChannelReturnsByteChannel() throws Exception {
URI uri = new URI(this.uriPrefix + "nested.jar");
Path path = this.provider.getPath(uri);
SeekableByteChannel byteChannel = this.provider.newByteChannel(path, Set.of(StandardOpenOption.READ));
assertThat(byteChannel).isInstanceOf(NestedByteChannel.class);
try (SeekableByteChannel byteChannel = this.provider.newByteChannel(path, Set.of(StandardOpenOption.READ))) {
assertThat(byteChannel).isInstanceOf(NestedByteChannel.class);
}
}
@Test