Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/CommandMatchers.java')
-rw-r--r--tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/CommandMatchers.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/CommandMatchers.java b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/CommandMatchers.java
index 3cd355c83b3..c8e7f58f9fc 100644
--- a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/CommandMatchers.java
+++ b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/matchers/CommandMatchers.java
@@ -17,7 +17,7 @@ import java.util.function.Predicate;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
+import org.hamcrest.TypeSafeDiagnosingMatcher;
/**
* Matchers for commands of various flavours, which are defined in nested classes.
@@ -34,15 +34,21 @@ public final class CommandMatchers {
}
static <C> Matcher<C> executable(Predicate<? super C> canExecute) {
- return new TypeSafeMatcher<C>() {
+ return new TypeSafeDiagnosingMatcher<C>() {
@Override
public void describeTo(Description description) {
- description.appendText("unexecutable");
+ description.appendText("executable");
}
@Override
- protected boolean matchesSafely(C item) {
- return canExecute.test(item);
+ protected boolean matchesSafely(C item, Description mismatch) {
+ boolean result = canExecute.test(item);
+
+ if (!result) {
+ mismatch.appendText("unexecutable");
+ }
+
+ return result;
}
};
}

Back to the top