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 c9639f77466ddfc62969bec2557a07556953f7cd Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Sat Jan 24 19:39:52 2026 +0000 CAMEL-21196: modernize exception-based assertions in camel-guava-eventbus --- .../eventbus/GuavaEventBusConsumerConfigurationTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java b/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java index b477f4d90f10..f3149d297f7e 100644 --- a/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java +++ b/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.jupiter.api.Assertions.assertThrows; public class GuavaEventBusConsumerConfigurationTest extends CamelTestSupport { @@ -49,13 +49,11 @@ public class GuavaEventBusConsumerConfigurationTest extends CamelTestSupport { } }); - try { + Exception e = assertThrows(Exception.class, () -> { context.start(); - fail("Should throw exception"); - } catch (Exception e) { - IllegalStateException ise = assertIsInstanceOf(IllegalStateException.class, e.getCause()); - assertEquals("You cannot set both 'eventClass' and 'listenerInterface' parameters.", ise.getMessage()); - } + }); + IllegalStateException ise = assertIsInstanceOf(IllegalStateException.class, e.getCause()); + assertEquals("You cannot set both 'eventClass' and 'listenerInterface' parameters.", ise.getMessage()); } }
