|
|
188f0f |
From 9507c7b942a25f89428c95abb0012d30aff0ca9b Mon Sep 17 00:00:00 2001
|
|
|
188f0f |
From: Marian Koncek <mkoncek@redhat.com>
|
|
|
188f0f |
Date: Thu, 29 Aug 2019 12:48:20 +0200
|
|
|
188f0f |
Subject: [PATCH] Port to hamcrest 2.1
|
|
|
188f0f |
|
|
|
188f0f |
---
|
|
|
188f0f |
.../org/junit/internal/matchers/StacktracePrintingMatcher.java | 3 ---
|
|
|
188f0f |
.../org/junit/internal/matchers/ThrowableCauseMatcher.java | 2 --
|
|
|
188f0f |
.../org/junit/internal/matchers/ThrowableMessageMatcher.java | 2 --
|
|
|
188f0f |
src/main/java/org/junit/matchers/JUnitMatchers.java | 2 +-
|
|
|
188f0f |
.../experimental/theories/runner/WithDataPointMethod.java | 2 +-
|
|
|
188f0f |
5 files changed, 2 insertions(+), 9 deletions(-)
|
|
|
188f0f |
|
|
|
188f0f |
diff --git a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
188f0f |
index 5d45ba3..6e94a67 100644
|
|
|
188f0f |
--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
188f0f |
+++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
|
|
188f0f |
@@ -4,7 +4,6 @@ import java.io.PrintWriter;
|
|
|
188f0f |
import java.io.StringWriter;
|
|
|
188f0f |
|
|
|
188f0f |
import org.hamcrest.Description;
|
|
|
188f0f |
-import org.hamcrest.Factory;
|
|
|
188f0f |
import org.hamcrest.Matcher;
|
|
|
188f0f |
|
|
|
188f0f |
/**
|
|
|
188f0f |
@@ -42,13 +41,11 @@ public class StacktracePrintingMatcher<T extends Throwable> extends
|
|
|
188f0f |
return stringWriter.toString();
|
|
|
188f0f |
}
|
|
|
188f0f |
|
|
|
188f0f |
- @Factory
|
|
|
188f0f |
public static <T extends Throwable> Matcher<T> isThrowable(
|
|
|
188f0f |
Matcher<T> throwableMatcher) {
|
|
|
188f0f |
return new StacktracePrintingMatcher<T>(throwableMatcher);
|
|
|
188f0f |
}
|
|
|
188f0f |
|
|
|
188f0f |
- @Factory
|
|
|
188f0f |
public static <T extends Exception> Matcher<T> isException(
|
|
|
188f0f |
Matcher<T> exceptionMatcher) {
|
|
|
188f0f |
return new StacktracePrintingMatcher<T>(exceptionMatcher);
|
|
|
188f0f |
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
188f0f |
index 22ce8bd..4fa89e7 100644
|
|
|
188f0f |
--- a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
188f0f |
+++ b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
|
|
188f0f |
@@ -1,7 +1,6 @@
|
|
|
188f0f |
package org.junit.internal.matchers;
|
|
|
188f0f |
|
|
|
188f0f |
import org.hamcrest.Description;
|
|
|
188f0f |
-import org.hamcrest.Factory;
|
|
|
188f0f |
import org.hamcrest.Matcher;
|
|
|
188f0f |
import org.hamcrest.TypeSafeMatcher;
|
|
|
188f0f |
|
|
|
188f0f |
@@ -43,7 +42,6 @@ public class ThrowableCauseMatcher<T extends Throwable> extends
|
|
|
188f0f |
* @param matcher to apply to the cause of the outer exception
|
|
|
188f0f |
* @param <T> type of the outer exception
|
|
|
188f0f |
*/
|
|
|
188f0f |
- @Factory
|
|
|
188f0f |
public static <T extends Throwable> Matcher<T> hasCause(final Matcher matcher) {
|
|
|
188f0f |
return new ThrowableCauseMatcher<T>(matcher);
|
|
|
188f0f |
}
|
|
|
188f0f |
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
188f0f |
index 74386a8..7d16b11 100644
|
|
|
188f0f |
--- a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
188f0f |
+++ b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
|
|
188f0f |
@@ -1,7 +1,6 @@
|
|
|
188f0f |
package org.junit.internal.matchers;
|
|
|
188f0f |
|
|
|
188f0f |
import org.hamcrest.Description;
|
|
|
188f0f |
-import org.hamcrest.Factory;
|
|
|
188f0f |
import org.hamcrest.Matcher;
|
|
|
188f0f |
import org.hamcrest.TypeSafeMatcher;
|
|
|
188f0f |
|
|
|
188f0f |
@@ -30,7 +29,6 @@ public class ThrowableMessageMatcher<T extends Throwable> extends
|
|
|
188f0f |
matcher.describeMismatch(item.getMessage(), description);
|
|
|
188f0f |
}
|
|
|
188f0f |
|
|
|
188f0f |
- @Factory
|
|
|
188f0f |
public static <T extends Throwable> Matcher<T> hasMessage(final Matcher<String> matcher) {
|
|
|
188f0f |
return new ThrowableMessageMatcher<T>(matcher);
|
|
|
188f0f |
}
|
|
|
188f0f |
diff --git a/src/main/java/org/junit/matchers/JUnitMatchers.java b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
188f0f |
index 13407cc..8889266 100644
|
|
|
188f0f |
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
188f0f |
+++ b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
|
|
188f0f |
@@ -56,7 +56,7 @@ public class JUnitMatchers {
|
|
|
188f0f |
* @deprecated Please use {@link CoreMatchers#everyItem(Matcher)} instead.
|
|
|
188f0f |
*/
|
|
|
188f0f |
@Deprecated
|
|
|
188f0f |
- public static <T> Matcher<Iterable<T>> everyItem(final Matcher<T> elementMatcher) {
|
|
|
188f0f |
+ public static <T> Matcher<Iterable<? extends T>> everyItem(final Matcher<T> elementMatcher) {
|
|
|
188f0f |
return CoreMatchers.everyItem(elementMatcher);
|
|
|
188f0f |
}
|
|
|
188f0f |
|
|
|
188f0f |
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
|
|
|
188f0f |
index c814508..ce22ef4 100644
|
|
|
188f0f |
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
188f0f |
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
|
|
188f0f |
@@ -108,7 +108,7 @@ public class WithDataPointMethod {
|
|
|
188f0f |
return JUnitCore.runClasses(type).getFailures();
|
|
|
188f0f |
}
|
|
|
188f0f |
|
|
|
188f0f |
- private Matcher<Iterable<Failure>> empty() {
|
|
|
188f0f |
+ private Matcher<Iterable<? extends Failure>> empty() {
|
|
|
188f0f |
return everyItem(nullValue(Failure.class));
|
|
|
188f0f |
}
|
|
|
188f0f |
}
|
|
|
188f0f |
--
|
|
|
188f0f |
2.21.0
|
|
|
188f0f |
|