You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2026/01/25 14:04:29 UTC
(camel) 15/36: CAMEL-21196: Modernize exception-based assertions in camel-aws
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 5b979e64308886fd7c31bf1184813d42962622a8
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Sat Jan 24 19:11:48 2026 +0000
CAMEL-21196: Modernize exception-based assertions in camel-aws
Replace try-catch-fail pattern with assertDoesNotThrow and assertThrows
for more idiomatic JUnit 5 exception testing in KinesisConsumerClosedShardWithFailTest.
Also removed unused fail() import.
---
.../aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java
index 00db8d79953f..6c19438dc4bf 100644
--- a/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java
+++ b/components/camel-aws/camel-aws2-kinesis/src/test/java/org/apache/camel/component/aws2/kinesis/KinesisConsumerClosedShardWithFailTest.java
@@ -42,8 +42,8 @@ import software.amazon.awssdk.services.kinesis.model.ShardIteratorType;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
@@ -98,11 +98,7 @@ public class KinesisConsumerClosedShardWithFailTest {
@Test
public void itObtainsAShardIteratorOnFirstPoll() {
- try {
- underTest.poll();
- } catch (Exception e) {
- fail("The first call should not throw an exception");
- }
+ assertDoesNotThrow(underTest::poll);
assertThrows(IllegalStateException.class, () -> {
underTest.poll();
});