@@ -69,7 +69,6 @@ class ZipArchiveTest {
69
69
private def manifestAt (location : URI ): URL = classLoader(location).getResource(" META-INF/MANIFEST.MF" )
70
70
71
71
72
- // ZipArchive.fromManifestURL(URL)
73
72
@ Test def `manifest resources just works` (): Unit = {
74
73
val jar = createTestJar()
75
74
val archive = new ManifestResources (manifestAt(jar.toUri))
@@ -79,23 +78,26 @@ class ZipArchiveTest {
79
78
val f = it.next()
80
79
assertFalse(it.hasNext)
81
80
assertEquals(" foo.class" , f.name)
82
- }
83
- finally {
81
+ } finally {
84
82
archive.close()
85
83
Files .delete(jar)
86
84
}
87
85
}
88
86
89
- private def createTestJar (): Path = Files .createTempFile(" junit" , " .jar" ).tap { f =>
87
+ private def createTestJar (): JPath = {
88
+ val f = Files .createTempFile(" junit" , " .jar" )
90
89
val man = new Manifest ()
91
90
man.getMainAttributes().put(Attributes .Name .MANIFEST_VERSION , " 1.0" )
92
91
man.getEntries().put(" foo.class" , new Attributes (0 ))
93
- Using .resource(new JarOutputStream (Files .newOutputStream(f), man)) { jout =>
92
+ val jout = new JarOutputStream (Files .newOutputStream(f), man)
93
+ try {
94
94
jout.putNextEntry(new JarEntry (" foo.class" ))
95
95
val bytes = " hello, world" .getBytes
96
96
jout.write(bytes, 0 , bytes.length)
97
- ()
97
+ } finally {
98
+ jout.close()
98
99
}
100
+ f
99
101
}
100
102
101
103
private def createTestZip (): Path = Files .createTempFile(" junit" , " .zip" ).tap { f =>
0 commit comments