This commit is contained in:
parent
b48c898d6a
commit
f5e0c8d184
@ -1,7 +1,7 @@
|
|||||||
From 85c780b61cd35b4544d2926393805e1699641f38 Mon Sep 17 00:00:00 2001
|
From d09cc37d39895b8b8b0bffb1c70d0a9d06df69a1 Mon Sep 17 00:00:00 2001
|
||||||
From: Marian Koncek <mkoncek@redhat.com>
|
From: Marian Koncek <mkoncek@redhat.com>
|
||||||
Date: Fri, 6 Mar 2020 14:28:05 +0100
|
Date: Fri, 6 Mar 2020 14:28:05 +0100
|
||||||
Subject: [PATCH] Port to hamcrest 2.2
|
Subject: [PATCH 1/2] Port to hamcrest 2.2
|
||||||
|
|
||||||
---
|
---
|
||||||
.../org/junit/internal/matchers/StacktracePrintingMatcher.java | 3 ---
|
.../org/junit/internal/matchers/StacktracePrintingMatcher.java | 3 ---
|
||||||
@ -12,7 +12,7 @@ Subject: [PATCH] Port to hamcrest 2.2
|
|||||||
5 files changed, 2 insertions(+), 9 deletions(-)
|
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
|
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
|
index 93a68276..3ea4a813 100644
|
||||||
--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
||||||
+++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
+++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
|
||||||
@@ -1,7 +1,6 @@
|
@@ -1,7 +1,6 @@
|
||||||
@ -38,7 +38,7 @@ index 93a6827..3ea4a81 100644
|
|||||||
Matcher<T> exceptionMatcher) {
|
Matcher<T> exceptionMatcher) {
|
||||||
return new StacktracePrintingMatcher<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
|
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
|
index 6e2ff5e3..1f0a0a02 100644
|
||||||
--- a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
--- a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
||||||
+++ b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
+++ b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
|
||||||
@@ -1,7 +1,6 @@
|
@@ -1,7 +1,6 @@
|
||||||
@ -58,7 +58,7 @@ index 6e2ff5e..1f0a0a0 100644
|
|||||||
return new ThrowableCauseMatcher<T>(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
|
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
|
index 74386a86..7d16b11b 100644
|
||||||
--- a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
--- a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
||||||
+++ b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
+++ b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
|
||||||
@@ -1,7 +1,6 @@
|
@@ -1,7 +1,6 @@
|
||||||
@ -78,7 +78,7 @@ index 74386a8..7d16b11 100644
|
|||||||
return new ThrowableMessageMatcher<T>(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
|
diff --git a/src/main/java/org/junit/matchers/JUnitMatchers.java b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
||||||
index 13407cc..8889266 100644
|
index 13407cc0..8889266e 100644
|
||||||
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java
|
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java
|
||||||
+++ b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
+++ b/src/main/java/org/junit/matchers/JUnitMatchers.java
|
||||||
@@ -56,7 +56,7 @@ public class JUnitMatchers {
|
@@ -56,7 +56,7 @@ public class JUnitMatchers {
|
||||||
@ -91,7 +91,7 @@ index 13407cc..8889266 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
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
|
index f2b27531..e5759ed8 100644
|
||||||
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
|
||||||
+++ b/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 {
|
@@ -108,7 +108,7 @@ public class WithDataPointMethod {
|
||||||
@ -104,5 +104,5 @@ index f2b2753..e5759ed 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.25.2
|
2.44.0
|
||||||
|
|
||||||
|
@ -0,0 +1,67 @@
|
|||||||
|
From 12270ec059bb103dcfb1d11c359e25c7ce5953da Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christine Poerschke <cpoerschke@bloomberg.net>
|
||||||
|
Date: Thu, 30 Dec 2021 08:44:54 +0000
|
||||||
|
Subject: [PATCH 2/2] remove usages of deprecated org.junit.Assert.assertThat()
|
||||||
|
|
||||||
|
---
|
||||||
|
src/main/java/org/junit/rules/ErrorCollector.java | 4 ++--
|
||||||
|
src/main/java/org/junit/rules/ExpectedException.java | 4 ++--
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/junit/rules/ErrorCollector.java b/src/main/java/org/junit/rules/ErrorCollector.java
|
||||||
|
index 9711e503..f846d776 100644
|
||||||
|
--- a/src/main/java/org/junit/rules/ErrorCollector.java
|
||||||
|
+++ b/src/main/java/org/junit/rules/ErrorCollector.java
|
||||||
|
@@ -1,6 +1,5 @@
|
||||||
|
package org.junit.rules;
|
||||||
|
|
||||||
|
-import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.assertThrows;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
@@ -10,6 +9,7 @@ import java.util.concurrent.Callable;
|
||||||
|
import org.junit.function.ThrowingRunnable;
|
||||||
|
import org.junit.internal.AssumptionViolatedException;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
+import org.hamcrest.MatcherAssert;
|
||||||
|
import org.junit.runners.model.MultipleFailureException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -74,7 +74,7 @@ public class ErrorCollector extends Verifier {
|
||||||
|
public <T> void checkThat(final String reason, final T value, final Matcher<T> matcher) {
|
||||||
|
checkSucceeds(new Callable<Object>() {
|
||||||
|
public Object call() throws Exception {
|
||||||
|
- assertThat(reason, value, matcher);
|
||||||
|
+ MatcherAssert.assertThat(reason, value, matcher);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
diff --git a/src/main/java/org/junit/rules/ExpectedException.java b/src/main/java/org/junit/rules/ExpectedException.java
|
||||||
|
index 431ad495..16550851 100644
|
||||||
|
--- a/src/main/java/org/junit/rules/ExpectedException.java
|
||||||
|
+++ b/src/main/java/org/junit/rules/ExpectedException.java
|
||||||
|
@@ -3,11 +3,11 @@ package org.junit.rules;
|
||||||
|
import static java.lang.String.format;
|
||||||
|
import static org.hamcrest.CoreMatchers.containsString;
|
||||||
|
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||||
|
-import static org.junit.Assert.assertThat;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
import static org.junit.internal.matchers.ThrowableCauseMatcher.hasCause;
|
||||||
|
import static org.junit.internal.matchers.ThrowableMessageMatcher.hasMessage;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
+import org.hamcrest.MatcherAssert;
|
||||||
|
import org.hamcrest.StringDescription;
|
||||||
|
import org.junit.AssumptionViolatedException;
|
||||||
|
import org.junit.runners.model.Statement;
|
||||||
|
@@ -268,7 +268,7 @@ public class ExpectedException implements TestRule {
|
||||||
|
|
||||||
|
private void handleException(Throwable e) throws Throwable {
|
||||||
|
if (isAnyExceptionExpected()) {
|
||||||
|
- assertThat(e, matcherBuilder.build());
|
||||||
|
+ MatcherAssert.assertThat(e, matcherBuilder.build());
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.44.0
|
||||||
|
|
12
junit.spec
12
junit.spec
@ -26,9 +26,10 @@ URL: https://junit.org/junit4/
|
|||||||
Source0: %{name}-%{version}.tar.xz
|
Source0: %{name}-%{version}.tar.xz
|
||||||
Source1: %{name}-build.xml
|
Source1: %{name}-build.xml
|
||||||
Patch0: 0001-Port-to-hamcrest-2.2.patch
|
Patch0: 0001-Port-to-hamcrest-2.2.patch
|
||||||
|
Patch1: 0002-remove-usages-of-deprecated-org.junit.Assert.assertT.patch
|
||||||
BuildRequires: ant
|
BuildRequires: ant
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: hamcrest >= 1.3
|
BuildRequires: hamcrest >= 2.0
|
||||||
BuildRequires: java-devel >= 1.8
|
BuildRequires: java-devel >= 1.8
|
||||||
BuildRequires: javapackages-local >= 6
|
BuildRequires: javapackages-local >= 6
|
||||||
Provides: %{name}-demo = %{version}-%{release}
|
Provides: %{name}-demo = %{version}-%{release}
|
||||||
@ -63,19 +64,12 @@ Documentation for %{name}.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%if %{?pkg_vcmp:%pkg_vcmp hamcrest >= 2.0}%{!?pkg_vcmp:0}
|
|
||||||
%patch -P 0 -p1
|
%patch -P 0 -p1
|
||||||
%endif
|
%patch -P 1 -p1
|
||||||
cp %{SOURCE1} build.xml
|
cp %{SOURCE1} build.xml
|
||||||
|
|
||||||
find . -type f -name "*.jar" -or -name "*.class" | xargs -t rm -rf
|
find . -type f -name "*.jar" -or -name "*.class" | xargs -t rm -rf
|
||||||
|
|
||||||
%if %{?pkg_vcmp:%pkg_vcmp hamcrest >= 2.0}%{!?pkg_vcmp:0}
|
|
||||||
ln -s $(build-classpath hamcrest/hamcrest) lib/hamcrest-core-1.3.jar
|
|
||||||
%else
|
|
||||||
ln -s $(build-classpath hamcrest/all) lib/hamcrest-core-1.3.jar
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
build-jar-repository -s lib hamcrest
|
build-jar-repository -s lib hamcrest
|
||||||
ant jar javadoc
|
ant jar javadoc
|
||||||
|
Loading…
Reference in New Issue
Block a user