gnodet-bot commented on code in PR #26665:
URL: https://github.com/apache/camel/pull/26665#discussion_r4060362317


##########
dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/download/DependencyDownloaderResourceLoaderTest.java:
##########
@@ -61,6 +61,20 @@ void aResourceThatIsNowhereKeepsItsName() {
         assertEquals("classpath:missing.groovy", resource.getLocation(), "the 
error names the resource as written");
     }
 
+    /** CAMEL-24865: under --source-dir a resource that exists nowhere keeps 
its original (not found) answer. */
+    @Test
+    void aMissingResourceUnderSourceDirIsStillMissing() throws Exception {
+        Path sourceDir = Files.createDirectory(routes.resolve("src"));
+        SimpleCamelContext context = new SimpleCamelContext();
+        DependencyDownloaderResourceLoader loader
+                = new DependencyDownloaderResourceLoader(context, 
sourceDir.toString(), List.of());
+
+        Resource resource = 
loader.resolveResource("classpath:camel-joor.properties");

Review Comment:
   💡 The test uses `"classpath:camel-joor.properties"` (no query param), but 
the JIRA ticket describes the failure as 
`classpath:camel-joor.properties?optional=true`. Both work with the fix, but 
adding a second assertion with the `?optional=true` form would directly prove 
the regression is gone:
   
   ```java
           // The bug URI: with ?optional=true it must still be optional after 
the fix
           Resource optional = 
loader.resolveResource("classpath:camel-joor.properties?optional=true");
           assertFalse(optional.exists());
           assertEquals("classpath:camel-joor.properties?optional=true", 
optional.getLocation(),
                   "?optional=true resource must not be replaced by a 
non-existent file");
   ```



-- 
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]

Reply via email to