|
|
debbc5 |
From 85c780b61cd35b4544d2926393805e1699641f38 Mon Sep 17 00:00:00 2001
|
|
|
debbc5 |
From: Marian Koncek <mkoncek@redhat.com>
|
|
|
debbc5 |
Date: Fri, 6 Mar 2020 14:28:05 +0100
|
|
|
debbc5 |
Subject: [PATCH] Port to hamcrest 2.2
|
|
|
debbc5 |
|
|
|
debbc5 |
---
|
|
|
debbc5 |
.../org/junit/internal/matchers/StacktracePrintingMatcher.java | 3 ---
|
|
|
debbc5 |
.../org/junit/internal/matchers/ThrowableCauseMatcher.java | 2 --
|
|
|
debbc5 |
.../org/junit/internal/matchers/ThrowableMessageMatcher.java | 2 --
|
|
|
debbc5 |
src/main/java/org/junit/matchers/JUnitMatchers.java | 2 +-
|
|
|
debbc5 |
.../experimental/theories/runner/WithDataPointMethod.java | 2 +-
|
|
|
debbc5 |
5 files changed, 2 insertions(+), 9 deletions(-)
|
|
|
debbc5 |
|
|
|
debbc5 |
diff --git a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
debbc5 |
index 93a6827..3ea4a81 100644
|
|
|
debbc5 |
--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
debbc5 |
+++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
debbc5 |
@@ -1,7 +1,6 @@
|
|
|
debbc5 |
package org.junit.internal.matchers;
|
|
|
debbc5 |
|
|
|
debbc5 |
import org.hamcrest.Description;
|
|
|
debbc5 |
-import org.hamcrest.Factory;
|
|
|
debbc5 |
import org.hamcrest.Matcher;
|
|
|
debbc5 |
|
|
|
debbc5 |
import org.junit.internal.Throwables;
|
|
|
debbc5 |
@@ -39,13 +38,11 @@ public class StacktracePrintingMatcher<T extends Throwable> extends
|
|
|
debbc5 |
return Throwables.getStacktrace(throwable);
|
|
|
debbc5 |
}
|
|
|
debbc5 |
|
|
|
debbc5 |
- @Factory
|
|
|
debbc5 |
public static <T extends Throwable> Matcher<T> isThrowable(
|
|
|
debbc5 |
Matcher<T> throwableMatcher) {
|
|
|
debbc5 |
return new StacktracePrintingMatcher<T>(throwableMatcher);
|
|
|
debbc5 |
}
|
|
|
debbc5 |
|
|
|
debbc5 |
- @Factory
|
|
|
debbc5 |
public static <T extends Exception> Matcher<T> isException(
|
|
|
debbc5 |
Matcher<T> exceptionMatcher) {
|
|
|
debbc5 |
return new StacktracePrintingMatcher<T>(exceptionMatcher);
|
|
|
debbc5 |
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
debbc5 |
index 6e2ff5e..1f0a0a0 100644
|
|
|
debbc5 |
--- a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
debbc5 |
+++ b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
debbc5 |
@@ -1,7 +1,6 @@
|
|
|
debbc5 |
package org.junit.internal.matchers;
|
|
|
debbc5 |
|
|
|
debbc5 |
import org.hamcrest.Description;
|
|
|
debbc5 |
-import org.hamcrest.Factory;
|
|
|
debbc5 |
import org.hamcrest.Matcher;
|
|
|
debbc5 |
import org.hamcrest.TypeSafeMatcher;
|
|
|
debbc5 |
|
|
|
debbc5 |
@@ -43,7 +42,6 @@ public class ThrowableCauseMatcher<T extends Throwable> extends
|
|
|
debbc5 |
* @param matcher to apply to the cause of the outer exception
|
|
|
debbc5 |
* @param <T> type of the outer exception
|
|
|
debbc5 |
*/
|
|
|
debbc5 |
- @Factory
|
|
|
debbc5 |
public static <T extends Throwable> Matcher<T> hasCause(final Matcher matcher) {
|
|
|
debbc5 |
return new ThrowableCauseMatcher<T>(matcher);
|
|
|
debbc5 |
}
|
|
|
debbc5 |
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
debbc5 |
index 74386a8..7d16b11 100644
|
|
|
debbc5 |
--- a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
debbc5 |
+++ b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
debbc5 |
@@ -1,7 +1,6 @@
|
|
|
debbc5 |
package org.junit.internal.matchers;
|
|
|
debbc5 |
|
|
|
debbc5 |
import org.hamcrest.Description;
|
|
|
debbc5 |
-import org.hamcrest.Factory;
|
|
|
debbc5 |
import org.hamcrest.Matcher;
|
|
|
debbc5 |
import org.hamcrest.TypeSafeMatcher;
|
|
|
debbc5 |
|
|
|
debbc5 |
@@ -30,7 +29,6 @@ public class ThrowableMessageMatcher<T extends Throwable> extends
|
|
|
debbc5 |
matcher.describeMismatch(item.getMessage(), description);
|
|
|
debbc5 |
}
|
|
|
debbc5 |
|
|
|
debbc5 |
- @Factory
|
|
|
debbc5 |
public static <T extends Throwable> Matcher<T> hasMessage(final Matcher<String> matcher) {
|
|
|
debbc5 |
return new ThrowableMessageMatcher<T>(matcher);
|
|
|
debbc5 |
}
|
|
|
debbc5 |
diff --git a/src/main/java/org/junit/matchers/JUnitMatchers.java b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
debbc5 |
index 13407cc..8889266 100644
|
|
|
debbc5 |
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
debbc5 |
+++ b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
debbc5 |
@@ -56,7 +56,7 @@ public class JUnitMatchers {
|
|
|
debbc5 |
* @deprecated Please use {@link CoreMatchers#everyItem(Matcher)} instead.
|
|
|
debbc5 |
*/
|
|
|
debbc5 |
@Deprecated
|
|
|
debbc5 |
- public static <T> Matcher<Iterable<T>> everyItem(final Matcher<T> elementMatcher) {
|
|
|
debbc5 |
+ public static <T> Matcher<Iterable<? extends T>> everyItem(final Matcher<T> elementMatcher) {
|
|
|
debbc5 |
return CoreMatchers.everyItem(elementMatcher);
|
|
|
debbc5 |
}
|
|
|
debbc5 |
|
|
|
debbc5 |
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
debbc5 |
index f2b2753..e5759ed 100644
|
|
|
debbc5 |
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
debbc5 |
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
debbc5 |
@@ -108,7 +108,7 @@ public class WithDataPointMethod {
|
|
|
debbc5 |
return JUnitCore.runClasses(type).getFailures();
|
|
|
debbc5 |
}
|
|
|
debbc5 |
|
|
|
debbc5 |
- private Matcher<Iterable<Failure>> empty() {
|
|
|
debbc5 |
+ private Matcher<Iterable<? extends Failure>> empty() {
|
|
|
debbc5 |
return everyItem(nullValue(Failure.class));
|
|
|
debbc5 |
}
|
|
|
debbc5 |
}
|
|
|
debbc5 |
--
|
|
|
debbc5 |
2.25.2
|
|
|
debbc5 |
|