From e2d59e5707cdcb011cb8390dadbba7bbe7f64ece Mon Sep 17 00:00:00 2001 From: Marian Koncek Date: Tue, 24 Sep 2019 11:38:29 +0200 Subject: [PATCH] Port to hamcrest 2.1 --- .../junit/internal/matchers/StacktracePrintingMatcher.java | 3 --- .../org/junit/internal/matchers/ThrowableCauseMatcher.java | 4 +--- .../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, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java index 9e9505d..45dc4f1 100644 --- 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; @@ -43,13 +42,11 @@ public class StacktracePrintingMatcher extends return Throwables.getStacktrace(throwable); } - @Factory public static Matcher isThrowable( Matcher throwableMatcher) { return new StacktracePrintingMatcher(throwableMatcher); } - @Factory public static Matcher isException( Matcher exceptionMatcher) { return new StacktracePrintingMatcher(exceptionMatcher); diff --git a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java index a8d9cef..a3611b4 100644 --- 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; @@ -45,8 +44,7 @@ public class ThrowableCauseMatcher extends * @param matcher to apply to the cause of the outer exception * @param type of the outer exception */ - @Factory public static Matcher hasCause(final Matcher matcher) { return new ThrowableCauseMatcher(matcher); } -} \ No newline at end of file +} diff --git a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java index 74386a8..7d16b11 100644 --- 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 extends matcher.describeMismatch(item.getMessage(), description); } - @Factory public static Matcher hasMessage(final Matcher matcher) { return new ThrowableMessageMatcher(matcher); } diff --git a/src/main/java/org/junit/matchers/JUnitMatchers.java b/src/main/java/org/junit/matchers/JUnitMatchers.java index 47897c5..8ae4dcd 100644 --- a/src/main/java/org/junit/matchers/JUnitMatchers.java +++ b/src/main/java/org/junit/matchers/JUnitMatchers.java @@ -58,7 +58,7 @@ public class JUnitMatchers { * @deprecated Please use {@link CoreMatchers#everyItem(Matcher)} instead. */ @Deprecated - public static Matcher> everyItem(final Matcher elementMatcher) { + public static Matcher> everyItem(final Matcher 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 index c814508..ce22ef4 100644 --- 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> empty() { + private Matcher> empty() { return everyItem(nullValue(Failure.class)); } } -- 2.21.0