From 88b304df04dd2f537378c2bcef651d74c818a136 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Wed, 22 Apr 2020 11:27:19 +0200 Subject: [PATCH] Rework hamcrest 2.2 patch --- 0001-Port-to-hamcrest-2.1.patch | 39 ------------ 0001-Port-to-hamcrest-2.2.patch | 108 ++++++++++++++++++++++++++++++++ junit.spec | 6 +- 3 files changed, 109 insertions(+), 44 deletions(-) delete mode 100644 0001-Port-to-hamcrest-2.1.patch create mode 100644 0001-Port-to-hamcrest-2.2.patch diff --git a/0001-Port-to-hamcrest-2.1.patch b/0001-Port-to-hamcrest-2.1.patch deleted file mode 100644 index 015a7ee..0000000 --- a/0001-Port-to-hamcrest-2.1.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 41302698f39a6bda58e634a786ce2a6c290eadba Mon Sep 17 00:00:00 2001 -From: Marian Koncek -Date: Fri, 6 Mar 2020 14:28:05 +0100 -Subject: [PATCH] Port to hamcrest 2.1 - ---- - src/main/java/org/junit/matchers/JUnitMatchers.java | 2 +- - .../tests/experimental/theories/runner/WithDataPointMethod.java | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -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 f2b2753..e5759ed 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.24.1 - diff --git a/0001-Port-to-hamcrest-2.2.patch b/0001-Port-to-hamcrest-2.2.patch new file mode 100644 index 0000000..0d51ef4 --- /dev/null +++ b/0001-Port-to-hamcrest-2.2.patch @@ -0,0 +1,108 @@ +From 85c780b61cd35b4544d2926393805e1699641f38 Mon Sep 17 00:00:00 2001 +From: Marian Koncek +Date: Fri, 6 Mar 2020 14:28:05 +0100 +Subject: [PATCH] Port to hamcrest 2.2 + +--- + .../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 93a6827..3ea4a81 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; +@@ -39,13 +38,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 6e2ff5e..1f0a0a0 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 f2b2753..e5759ed 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.25.2 + diff --git a/junit.spec b/junit.spec index 75269cf..b070b0c 100644 --- a/junit.spec +++ b/junit.spec @@ -10,7 +10,7 @@ BuildArch: noarch Source0: %{name}-%{version}.tar.gz Source1: generate-tarball.sh -Patch1: 0001-Port-to-hamcrest-2.1.patch +Patch1: 0001-Port-to-hamcrest-2.2.patch BuildRequires: maven-local BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) @@ -40,10 +40,6 @@ Javadoc for %{name}. %patch1 -p1 -# Port to hamcrest 2.1 (Factory annotation removed with no effect) -find -name '*.java' -exec sed -i '/@Factory/d' {} + -find -name '*.java' -exec sed -i '/hamcrest\.Factory/d' {} + - # InaccessibleBaseClassTest fails with Java 8 sed -i /InaccessibleBaseClassTest/d src/test/java/org/junit/tests/AllTests.java