Close jar to allow it to be cleaned up after test execution
See gh-38766
This commit is contained in:
parent
1d64976876
commit
85cfa4798c
|
@ -96,9 +96,14 @@ class StaticResourceJarsTests {
|
||||||
File jarFile = createResourcesJar("test-resources.jar");
|
File jarFile = createResourcesJar("test-resources.jar");
|
||||||
TrackedURLStreamHandler handler = new TrackedURLStreamHandler(true);
|
TrackedURLStreamHandler handler = new TrackedURLStreamHandler(true);
|
||||||
URL url = new URL("jar", null, 0, jarFile.toURI().toURL().toString() + "!/", handler);
|
URL url = new URL("jar", null, 0, jarFile.toURI().toURL().toString() + "!/", handler);
|
||||||
new StaticResourceJars().getUrlsFrom(url);
|
try {
|
||||||
assertThatNoException()
|
new StaticResourceJars().getUrlsFrom(url);
|
||||||
.isThrownBy(() -> ((JarURLConnection) handler.getConnection()).getJarFile().getComment());
|
assertThatNoException()
|
||||||
|
.isThrownBy(() -> ((JarURLConnection) handler.getConnection()).getJarFile().getComment());
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
((JarURLConnection) handler.getConnection()).getJarFile().close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue