You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/08/30 12:58:36 UTC

(camel) 01/01: chore: camel-smb - fix SmbConsumerStartingDirectoryMustExistIT for route-start exception wrapping

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

davsclaus pushed a commit to branch quick-fix/smb-starting-directory-must-exist-test
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e708b488e98b9150129c4437a6caad371df08f2e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Aug 30 14:58:19 2026 +0200

    chore: camel-smb - fix SmbConsumerStartingDirectoryMustExistIT for route-start exception wrapping
    
    CAMEL-24404 (#25554) made InternalRouteStartupManager always wrap consumer
    startup failures in FailedToStartRouteException. This test still caught the
    raw GenericFileOperationFailedException around context.start(), so it no
    longer matched and the test failed on every CI run since that change merged.
    
    Assert on FailedToStartRouteException with the original exception as cause,
    matching how the other consumer-startup tests were updated for CAMEL-24404.
    
    Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
    Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
 components/camel-smb/pom.xml                              |  5 +++++
 .../smb/SmbConsumerStartingDirectoryMustExistIT.java      | 15 +++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/components/camel-smb/pom.xml b/components/camel-smb/pom.xml
index 430b2083260d..5642dcd6931e 100644
--- a/components/camel-smb/pom.xml
+++ b/components/camel-smb/pom.xml
@@ -72,6 +72,11 @@
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>
diff --git a/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbConsumerStartingDirectoryMustExistIT.java b/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbConsumerStartingDirectoryMustExistIT.java
index eebf62bc49f2..7a630d2a81e9 100644
--- a/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbConsumerStartingDirectoryMustExistIT.java
+++ b/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbConsumerStartingDirectoryMustExistIT.java
@@ -16,11 +16,12 @@
  */
 package org.apache.camel.component.smb;
 
+import org.apache.camel.FailedToStartRouteException;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.file.GenericFileOperationFailedException;
-import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
 public class SmbConsumerStartingDirectoryMustExistIT extends SmbServerTestSupport {
 
     @Override
@@ -42,12 +43,10 @@ public class SmbConsumerStartingDirectoryMustExistIT extends SmbServerTestSuppor
                 from(getSbmUrl()).to("mock:result");
             }
         });
-        try {
-            context.start();
-            Assertions.fail();
-        } catch (GenericFileOperationFailedException e) {
-            Assertions.assertEquals("Starting directory does not exist: doesnotexist", e.getMessage());
-        }
+
+        assertThatThrownBy(context::start)
+                .isInstanceOf(FailedToStartRouteException.class)
+                .cause().hasMessage("Starting directory does not exist: doesnotexist");
     }
 
 }