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 2020/08/29 15:39:52 UTC

[camel] branch master updated: camel-core: migrate throwable check to JUnit 5 assertion format (#4143)

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e0448c  camel-core: migrate throwable check to JUnit 5 assertion format (#4143)
8e0448c is described below

commit 8e0448ccb0b25cde44073c55bbb33336608c91dc
Author: Otavio Rodolfo Piske <or...@users.noreply.github.com>
AuthorDate: Sat Aug 29 17:39:33 2020 +0200

    camel-core: migrate throwable check to JUnit 5 assertion format (#4143)
---
 .../org/apache/camel/util/PredicateAssertHelperTest.java | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/core/camel-core/src/test/java/org/apache/camel/util/PredicateAssertHelperTest.java b/core/camel-core/src/test/java/org/apache/camel/util/PredicateAssertHelperTest.java
index 4c1637b..b1646de 100644
--- a/core/camel-core/src/test/java/org/apache/camel/util/PredicateAssertHelperTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/util/PredicateAssertHelperTest.java
@@ -25,7 +25,7 @@ import org.apache.camel.support.PredicateAssertHelper;
 import org.junit.jupiter.api.Test;
 
 import static org.apache.camel.builder.Builder.constant;
-import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class PredicateAssertHelperTest extends ContextTestSupport {
 
@@ -43,17 +43,7 @@ public class PredicateAssertHelperTest extends ContextTestSupport {
         Exchange exchange = new DefaultExchange(context);
         Predicate notNull = PredicateBuilder.isNotNull(constant(null));
 
-        try {
-            PredicateAssertHelper.assertMatches(notNull, "foo is not null", exchange);
-            fail("Should have thrown exception");
-        } catch (AssertionError e) {
-            // expected
-        }
-        try {
-            PredicateAssertHelper.assertMatches(notNull, null, exchange);
-            fail("Should have thrown exception");
-        } catch (AssertionError e) {
-            // expected
-        }
+        assertThrows(AssertionError.class, () -> PredicateAssertHelper.assertMatches(notNull, "foo is not null", exchange));
+        assertThrows(AssertionError.class, () -> PredicateAssertHelper.assertMatches(notNull, null, exchange));
     }
 }