You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2019/11/26 14:49:48 UTC
[flink] 01/06: [hotfix][core] Make CoreMatchers.containsCause more
flexible
This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit e383414bbf6529646d20d954670a5a7e2e2ba4aa
Author: Timo Walther <tw...@apache.org>
AuthorDate: Mon Nov 25 10:09:30 2019 +0100
[hotfix][core] Make CoreMatchers.containsCause more flexible
---
flink-core/src/test/java/org/apache/flink/util/CoreMatchers.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/flink-core/src/test/java/org/apache/flink/util/CoreMatchers.java b/flink-core/src/test/java/org/apache/flink/util/CoreMatchers.java
index 5b4e3de..ebdddc8 100644
--- a/flink-core/src/test/java/org/apache/flink/util/CoreMatchers.java
+++ b/flink-core/src/test/java/org/apache/flink/util/CoreMatchers.java
@@ -29,6 +29,9 @@ import java.util.Optional;
*/
public class CoreMatchers {
+ /**
+ * Checks for a {@link Throwable} that matches by class and message.
+ */
public static Matcher<Throwable> containsCause(Throwable failureCause) {
return new ContainsCauseMatcher(failureCause);
}
@@ -43,7 +46,10 @@ public class CoreMatchers {
@Override
protected boolean matchesSafely(Throwable throwable, Description description) {
- final Optional<Throwable> optionalCause = ExceptionUtils.findThrowable(throwable, cause -> cause.equals(failureCause));
+ final Optional<Throwable> optionalCause = ExceptionUtils.findThrowable(
+ throwable,
+ cause -> cause.getClass() == failureCause.getClass() &&
+ cause.getMessage().equals(failureCause.getMessage()));
if (!optionalCause.isPresent()) {
description