2024-04-28 18:46:00 +02:00
|
|
|
From d09cc37d39895b8b8b0bffb1c70d0a9d06df69a1 Mon Sep 17 00:00:00 2001
|
2022-06-09 20:12:21 +02:00
|
|
|
From: Marian Koncek <mkoncek@redhat.com>
|
|
|
|
Date: Fri, 6 Mar 2020 14:28:05 +0100
|
2024-04-28 18:46:00 +02:00
|
|
|
Subject: [PATCH 1/2] Port to hamcrest 2.2
|
2022-06-09 20:12:21 +02:00
|
|
|
|
|
|
|
---
|
|
|
|
.../org/junit/internal/matchers/StacktracePrintingMatcher.java | 3 ---
|
|
|
|
.../org/junit/internal/matchers/ThrowableCauseMatcher.java | 2 --
|
|
|
|
.../org/junit/internal/matchers/ThrowableMessageMatcher.java | 2 --
|
|
|
|
src/main/java/org/junit/matchers/JUnitMatchers.java | 2 +-
|
|
|
|
.../experimental/theories/runner/WithDataPointMethod.java | 2 +-
|
|
|
|
5 files changed, 2 insertions(+), 9 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
2024-04-28 18:46:00 +02:00
|
|
|
index 93a68276..3ea4a813 100644
|
2022-06-09 20:12:21 +02:00
|
|
|
--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
|
+++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
|
@@ -1,7 +1,6 @@
|
|
|
|
package org.junit.internal.matchers;
|
|
|
|
|
|
|
|
import org.hamcrest.Description;
|
|
|
|
-import org.hamcrest.Factory;
|
|
|
|
import org.hamcrest.Matcher;
|
|
|
|
|
|
|
|
import org.junit.internal.Throwables;
|
|
|
|
@@ -39,13 +38,11 @@ public class StacktracePrintingMatcher<T extends Throwable> extends
|
|
|
|
return Throwables.getStacktrace(throwable);
|
|
|
|
}
|
|
|
|
|
|
|
|
- @Factory
|
|
|
|
public static <T extends Throwable> Matcher<T> isThrowable(
|
|
|
|
Matcher<T> throwableMatcher) {
|
|
|
|
return new StacktracePrintingMatcher<T>(throwableMatcher);
|
|
|
|
}
|
|
|
|
|
|
|
|
- @Factory
|
|
|
|
public static <T extends Exception> Matcher<T> isException(
|
|
|
|
Matcher<T> exceptionMatcher) {
|
|
|
|
return new StacktracePrintingMatcher<T>(exceptionMatcher);
|
|
|
|
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
2024-04-28 18:46:00 +02:00
|
|
|
index 6e2ff5e3..1f0a0a02 100644
|
2022-06-09 20:12:21 +02:00
|
|
|
--- a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
|
+++ b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
|
@@ -1,7 +1,6 @@
|
|
|
|
package org.junit.internal.matchers;
|
|
|
|
|
|
|
|
import org.hamcrest.Description;
|
|
|
|
-import org.hamcrest.Factory;
|
|
|
|
import org.hamcrest.Matcher;
|
|
|
|
import org.hamcrest.TypeSafeMatcher;
|
|
|
|
|
|
|
|
@@ -43,7 +42,6 @@ public class ThrowableCauseMatcher<T extends Throwable> extends
|
|
|
|
* @param matcher to apply to the cause of the outer exception
|
|
|
|
* @param <T> type of the outer exception
|
|
|
|
*/
|
|
|
|
- @Factory
|
|
|
|
public static <T extends Throwable> Matcher<T> hasCause(final Matcher<?> matcher) {
|
|
|
|
return new ThrowableCauseMatcher<T>(matcher);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
2024-04-28 18:46:00 +02:00
|
|
|
index 74386a86..7d16b11b 100644
|
2022-06-09 20:12:21 +02:00
|
|
|
--- a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
|
+++ b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
|
@@ -1,7 +1,6 @@
|
|
|
|
package org.junit.internal.matchers;
|
|
|
|
|
|
|
|
import org.hamcrest.Description;
|
|
|
|
-import org.hamcrest.Factory;
|
|
|
|
import org.hamcrest.Matcher;
|
|
|
|
import org.hamcrest.TypeSafeMatcher;
|
|
|
|
|
|
|
|
@@ -30,7 +29,6 @@ public class ThrowableMessageMatcher<T extends Throwable> extends
|
|
|
|
matcher.describeMismatch(item.getMessage(), description);
|
|
|
|
}
|
|
|
|
|
|
|
|
- @Factory
|
|
|
|
public static <T extends Throwable> Matcher<T> hasMessage(final Matcher<String> matcher) {
|
|
|
|
return new ThrowableMessageMatcher<T>(matcher);
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/junit/matchers/JUnitMatchers.java b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
2024-04-28 18:46:00 +02:00
|
|
|
index 13407cc0..8889266e 100644
|
2022-06-09 20:12:21 +02:00
|
|
|
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
|
+++ b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
|
@@ -56,7 +56,7 @@ public class JUnitMatchers {
|
|
|
|
* @deprecated Please use {@link CoreMatchers#everyItem(Matcher)} instead.
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
- public static <T> Matcher<Iterable<T>> everyItem(final Matcher<T> elementMatcher) {
|
|
|
|
+ public static <T> Matcher<Iterable<? extends T>> everyItem(final Matcher<T> elementMatcher) {
|
|
|
|
return CoreMatchers.everyItem(elementMatcher);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2024-04-28 18:46:00 +02:00
|
|
|
index f2b27531..e5759ed8 100644
|
2022-06-09 20:12:21 +02:00
|
|
|
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
|
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
|
@@ -108,7 +108,7 @@ public class WithDataPointMethod {
|
|
|
|
return JUnitCore.runClasses(type).getFailures();
|
|
|
|
}
|
|
|
|
|
|
|
|
- private Matcher<Iterable<Failure>> empty() {
|
|
|
|
+ private Matcher<Iterable<? extends Failure>> empty() {
|
|
|
|
return everyItem(nullValue(Failure.class));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
2024-04-28 18:46:00 +02:00
|
|
|
2.44.0
|
2022-06-09 20:12:21 +02:00
|
|
|
|