From 82f045811c0404b6e17f2db6c1dba24922eb4bb1 Mon Sep 17 00:00:00 2001 From: Marian Koncek Date: Thu, 29 Aug 2019 12:50:26 +0200 Subject: [PATCH] Port to hamcrest 2.1 --- 0001-Port-to-hamcrest-2.1.patch | 108 ++++++++++++++++++++++++++++++++ junit.spec | 4 ++ 2 files changed, 112 insertions(+) create mode 100644 0001-Port-to-hamcrest-2.1.patch diff --git a/0001-Port-to-hamcrest-2.1.patch b/0001-Port-to-hamcrest-2.1.patch new file mode 100644 index 0000000..16b864a --- /dev/null +++ b/0001-Port-to-hamcrest-2.1.patch @@ -0,0 +1,108 @@ +From 9507c7b942a25f89428c95abb0012d30aff0ca9b Mon Sep 17 00:00:00 2001 +From: Marian Koncek +Date: Thu, 29 Aug 2019 12:48:20 +0200 +Subject: [PATCH] Port to hamcrest 2.1 + +--- + .../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 +index 5d45ba3..6e94a67 100644 +--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java ++++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java +@@ -4,7 +4,6 @@ import java.io.PrintWriter; + import java.io.StringWriter; + + import org.hamcrest.Description; +-import org.hamcrest.Factory; + import org.hamcrest.Matcher; + + /** +@@ -42,13 +41,11 @@ public class StacktracePrintingMatcher extends + return stringWriter.toString(); + } + +- @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 22ce8bd..4fa89e7 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; + +@@ -43,7 +42,6 @@ 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); + } +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 13407cc..8889266 100644 +--- 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 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 + diff --git a/junit.spec b/junit.spec index 5e15f6e..5fd85d5 100644 --- a/junit.spec +++ b/junit.spec @@ -11,6 +11,8 @@ BuildArch: noarch Source0: %{name}-%{version}-clean.tar.gz Source3: create-tarball.sh +Patch1: 0001-Port-to-hamcrest-2.1.patch + BuildRequires: maven-local BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin) @@ -38,6 +40,8 @@ Javadoc for %{name}. %prep %setup -q -n %{name}-r%{version} +%patch1 -p1 + # InaccessibleBaseClassTest fails with Java 8 sed -i /InaccessibleBaseClassTest/d src/test/java/org/junit/tests/AllTests.java