orpiske commented on code in PR #10804:
URL: https://github.com/apache/camel/pull/10804#discussion_r1272362916


##########
core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java:
##########
@@ -47,26 +48,13 @@ public void testRenameSuccess() throws Exception {
     }
 
     @Test
-    public void testIllegalOptions() throws Exception {
-        try {
-            
context.getEndpoint(fileUri("?move=../done/${file:name}&delete=true")).createConsumer(new
 Processor() {
-                public void process(Exchange exchange) throws Exception {
-                }
-            });
-            fail("Should have thrown an exception");
-        } catch (IllegalArgumentException e) {
-            // ok
-        }
+    public void testIllegalOptions() {
 
-        try {
-            
context.getEndpoint(fileUri("?move=${file:name.noext}.bak&delete=true")).createConsumer(new
 Processor() {
-                public void process(Exchange exchange) throws Exception {
-                }
-            });
-            fail("Should have thrown an exception");
-        } catch (IllegalArgumentException e) {
-            // ok
-        }
+        Assertions.assertThrows(IllegalArgumentException.class, () -> 
context.getEndpoint(fileUri("?move=../done/${file:name}&delete=true")).createConsumer(exchange
 -> {
+        }), "Should have thrown an exception");

Review Comment:
   More likely you mean: 
   
   ```
          Endpoint ep = 
context.getEndpoint(fileUri("?move=../done/${file:name}&delete=true"));
           Assertions.assertThrows(IllegalArgumentException.class, () -> 
ep.createConsumer(exchange -> {
           }), "Should have thrown an exception");
   ```



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