@@ -0,0 +1,3376 @@
+package io.quarkus.bootstrap.classloader;%0A%0Aimport io.quarkus.bootstrap.classloading.DirectoryClassPathElement;%0Aimport io.quarkus.bootstrap.classloading.JarClassPathElement;%0Aimport io.quarkus.bootstrap.classloading.QuarkusClassLoader;%0Aimport io.quarkus.bootstrap.util.IoUtils;%0Aimport java.net.URL;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport org.jboss.shrinkwrap.api.ShrinkWrap;%0Aimport org.jboss.shrinkwrap.api.asset.StringAsset;%0Aimport org.jboss.shrinkwrap.api.exporter.ExplodedExporter;%0Aimport org.jboss.shrinkwrap.api.exporter.ZipExporter;%0Aimport org.jboss.shrinkwrap.api.spec.JavaArchive;%0Aimport org.junit.jupiter.api.Assertions;%0Aimport org.junit.jupiter.api.Test;%0A%0A//see https://github.com/quarkusio/quarkus/issues/10943%0Apublic class ClassLoadingResourceUrlTestCase %7B%0A%0A    /**%0A     * URLClassLoader will return URL's that end with a / if the call to getResource ends with a /%0A     */%0A    @Test%0A    public void testUrlReturnedFromClassLoaderDirectory() throws Exception %7B%0A        JavaArchive jar = ShrinkWrap.create(JavaArchive.class)%0A                .add(new StringAsset(%22a%22), %22a.txt%22)%0A                .add(new StringAsset(%22b%22), %22b/b.txt%22);%0A        Path path = Files.createTempDirectory(%22test%22);%0A        try %7B%0A            jar.as(ExplodedExporter.class).exportExploded(path.toFile(), %22tmp%22);%0A%0A            ClassLoader cl = QuarkusClassLoader.builder(%22test%22, getClass().getClassLoader(), false)%0A                    .addElement(new DirectoryClassPathElement(path.resolve(%22tmp%22)))%0A                    .build();%0A            URL res = cl.getResource(%22a.txt%22);%0A            Assertions.assertNotNull(res);%0A            res = cl.getResource(%22a.txt/%22);%0A            Assertions.assertNull(res);%0A%0A            res = cl.getResource(%22b%22);%0A            Assertions.assertNotNull(res);%0A            Assertions.assertFalse(res.toExternalForm().endsWith(%22/%22));%0A%0A            res = cl.getResource(%22b/%22);%0A            Assertions.assertNotNull(res);%0A            Assertions.assertTrue(res.toExternalForm().endsWith(%22/%22));%0A%0A        %7D finally %7B%0A            IoUtils.recursiveDelete(path);%0A        %7D%0A    %7D%0A%0A    /**%0A     * URLClassLoader will return URL's that end with a / if the call to getResource ends with a /%0A     */%0A    @Test%0A    public void testUrlReturnedFromClassLoaderJarFile() throws Exception %7B%0A        JavaArchive jar = ShrinkWrap.create(JavaArchive.class)%0A                .add(new StringAsset(%22a%22), %22a.txt%22)%0A                .add(new StringAsset(%22b%22), %22b/b.txt%22);%0A        Path path = Files.createTempFile(%22test%22, %22quarkus-test.jar%22);%0A        try %7B%0A            jar.as(ZipExporter.class).exportTo(path.toFile(), true);%0A%0A            ClassLoader cl = QuarkusClassLoader.builder(%22test%22, getClass().getClassLoader(), false)%0A                    .addElement(new JarClassPathElement(path))%0A                    .build();%0A            URL res = cl.getResource(%22a.txt%22);%0A            Assertions.assertNotNull(res);%0A            res = cl.getResource(%22a.txt/%22);%0A            Assertions.assertNull(res);%0A%0A            res = cl.getResource(%22b%22);%0A            Assertions.assertNotNull(res);%0A            Assertions.assertFalse(res.toExternalForm().endsWith(%22/%22));%0A%0A            res = cl.getResource(%22b/%22);%0A            Assertions.assertNotNull(res);%0A            Assertions.assertTrue(res.toExternalForm().endsWith(%22/%22));%0A%0A        %7D finally %7B%0A            IoUtils.recursiveDelete(path);%0A        %7D%0A    %7D%0A%7D%0A

Add URL test for QuarkusClassLoader