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 2023/07/17 15:39:39 UTC
[camel] branch main updated: (chores) camel-core: test cleanups on ResequenceStreamNotIgnoreInvalidExchangesTest
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
The following commit(s) were added to refs/heads/main by this push:
new ad163e1e826 (chores) camel-core: test cleanups on ResequenceStreamNotIgnoreInvalidExchangesTest
ad163e1e826 is described below
commit ad163e1e826a34bb8d37a7d834a38ff86fc421aa
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Mon Jul 17 16:34:41 2023 +0200
(chores) camel-core: test cleanups on ResequenceStreamNotIgnoreInvalidExchangesTest
- cleanup assertions
- increase timeouts for less flakiness on slow horts
---
...equenceStreamNotIgnoreInvalidExchangesTest.java | 43 ++++++++--------------
1 file changed, 16 insertions(+), 27 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/ResequenceStreamNotIgnoreInvalidExchangesTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/ResequenceStreamNotIgnoreInvalidExchangesTest.java
index d735fd96368..31026c4d783 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/ResequenceStreamNotIgnoreInvalidExchangesTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/ResequenceStreamNotIgnoreInvalidExchangesTest.java
@@ -21,7 +21,7 @@ import org.apache.camel.ContextTestSupport;
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;
/**
*
@@ -32,12 +32,9 @@ public class ResequenceStreamNotIgnoreInvalidExchangesTest extends ContextTestSu
public void testBadFirstMessage() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("B", "C", "D");
- try {
- template.sendBody("direct:start", "A");
- fail("Should fail");
- } catch (CamelExecutionException e) {
- // expected
- }
+ assertThrows(CamelExecutionException.class, () -> template.sendBody("direct:start", "A"),
+ "Should have thrown an exception");
+
template.sendBodyAndHeader("direct:start", "D", "seqno", 4);
template.sendBodyAndHeader("direct:start", "C", "seqno", 3);
template.sendBodyAndHeader("direct:start", "B", "seqno", 2);
@@ -50,12 +47,9 @@ public class ResequenceStreamNotIgnoreInvalidExchangesTest extends ContextTestSu
getMockEndpoint("mock:result").expectedBodiesReceived("B", "C", "D");
template.sendBodyAndHeader("direct:start", "D", "seqno", 4);
- try {
- template.sendBody("direct:start", "A");
- fail("Should fail");
- } catch (CamelExecutionException e) {
- // expected
- }
+
+ assertThrows(CamelExecutionException.class, () -> template.sendBody("direct:start", "A"),
+ "Should have thrown an exception");
template.sendBodyAndHeader("direct:start", "C", "seqno", 3);
template.sendBodyAndHeader("direct:start", "B", "seqno", 2);
@@ -68,12 +62,10 @@ public class ResequenceStreamNotIgnoreInvalidExchangesTest extends ContextTestSu
template.sendBodyAndHeader("direct:start", "D", "seqno", 4);
template.sendBodyAndHeader("direct:start", "C", "seqno", 3);
- try {
- template.sendBody("direct:start", "A");
- fail("Should fail");
- } catch (CamelExecutionException e) {
- // expected
- }
+
+ assertThrows(CamelExecutionException.class, () -> template.sendBody("direct:start", "A"),
+ "Should have thrown an exception");
+
template.sendBodyAndHeader("direct:start", "B", "seqno", 2);
assertMockEndpointsSatisfied();
@@ -86,12 +78,9 @@ public class ResequenceStreamNotIgnoreInvalidExchangesTest extends ContextTestSu
template.sendBodyAndHeader("direct:start", "D", "seqno", 4);
template.sendBodyAndHeader("direct:start", "C", "seqno", 3);
template.sendBodyAndHeader("direct:start", "B", "seqno", 2);
- try {
- template.sendBody("direct:start", "A");
- fail("Should fail");
- } catch (CamelExecutionException e) {
- // expected
- }
+
+ assertThrows(CamelExecutionException.class, () -> template.sendBody("direct:start", "A"),
+ "Should have thrown an exception");
assertMockEndpointsSatisfied();
}
@@ -100,8 +89,8 @@ public class ResequenceStreamNotIgnoreInvalidExchangesTest extends ContextTestSu
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
- public void configure() throws Exception {
- from("direct:start").resequence(header("seqno")).stream().timeout(50).deliveryAttemptInterval(10)
+ public void configure() {
+ from("direct:start").resequence(header("seqno")).stream().timeout(150).deliveryAttemptInterval(10)
.to("mock:result");
}
};