This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 85d808b3123dcb5f44edcf0ea46adb5285a99a91
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Sat Jan 24 19:39:49 2026 +0000

    CAMEL-21196: modernize exception-based assertions in camel-file-watch
---
 .../component/file/watch/FileWatchComponentNegativeTest.java      | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentNegativeTest.java
 
b/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentNegativeTest.java
index 7e14bf64c2ac..ef2be1b4cadd 100644
--- 
a/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentNegativeTest.java
+++ 
b/components/camel-file-watch/src/test/java/org/apache/camel/component/file/watch/FileWatchComponentNegativeTest.java
@@ -21,23 +21,21 @@ import java.nio.file.Paths;
 import org.apache.camel.builder.RouteBuilder;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class FileWatchComponentNegativeTest extends FileWatchComponentTestBase 
{
 
     @Test
     public void testNonExistentDirectory() throws Exception {
         String nonExistentDirectory = Paths.get(testPath(), 
"nonExistentDirectory").toString();
-        try {
+        assertThrows(Exception.class, () -> {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() {
                     from("file-watch://" + nonExistentDirectory + 
"?autoCreate=false").to("mock:watchAll");
                 }
             });
-            fail("Should throw exception");
-        } catch (Exception ignored) {
-        }
+        });
 
         context.addRoutes(new RouteBuilder() {
             @Override

Reply via email to