powerbroker commented on code in PR #34:
URL: https://github.com/apache/geronimo-xbean/pull/34#discussion_r1045269358
##########
xbean-finder/src/test/java/org/apache/xbean/finder/archive/JarArchiveTest.java:
##########
@@ -85,34 +87,53 @@ public void testLoadClass() throws Exception {
@Test
public void testIterator() throws Exception {
- List<String> actual = new ArrayList<>();
- for (Archive.Entry entry : this.archive) {
+ List<String> actual = new ArrayList<String>();
+ for (Archive.Entry entry : archive) {
actual.add(entry.getName());
}
Assert.assertFalse(0 == actual.size());
- for (Class clazz : JarArchiveTest.classes) {
+ for (Class clazz : classes) {
Assert.assertTrue(clazz.getName(),
actual.contains(clazz.getName()));
}
Assert.assertEquals(JarArchiveTest.classes.length, actual.size());
}
-
@Test
public void testXBEAN337() throws Exception {
+ // Virtual path
+ JarArchive jar;
+
String path = "/this!/!file!/does!/!not/exist.jar";
- URL[] urls = {new URL("jar:file:" + path + "!/")};
+ URL[] urls = {new URL("jar:file:" + path +
"!/some!/!inner!/.jar!/file.jar")};
try {
- this.archive = new JarArchive(new URLClassLoader(urls), urls[0]);
+ jar = new JarArchive(new URLClassLoader(urls), urls[0]);
}catch(Exception ex){
Assert.assertTrue(
"Muzz never fail on '/this', but try full path with
exclamations('%s') instead"
.formatted(path),
- ex.getCause().getMessage().contains("exist.jar"));
+ ex.getMessage().contains("exist.jar"));
}
+
+ // Real file
+
+ Path tmpDir = Files.createTempDirectory("!" +
JarArchiveTest.class.getSimpleName() + "!-");
Review Comment:
doesn't matter where it is in 4.22 - everything fails. think, test should
prove it works in any position
thx, good idea - @Rule TemporaryFolder. those temp files... ((
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]