Update to upstream version 4.13

This commit is contained in:
Marian Koncek 2020-03-06 14:49:34 +01:00
parent d0f7b6e6de
commit 0ba92bfe80
7 changed files with 44 additions and 198 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ junit3.8.2.zip
/r4.11.tar.gz /r4.11.tar.gz
/junit-4.11-clean.tar.gz /junit-4.11-clean.tar.gz
/junit-4.12-clean.tar.gz /junit-4.12-clean.tar.gz
/junit-4.13.tar.gz

View File

@ -1,82 +1,13 @@
From 9507c7b942a25f89428c95abb0012d30aff0ca9b Mon Sep 17 00:00:00 2001 From 41302698f39a6bda58e634a786ce2a6c290eadba Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com> From: Marian Koncek <mkoncek@redhat.com>
Date: Thu, 29 Aug 2019 12:48:20 +0200 Date: Fri, 6 Mar 2020 14:28:05 +0100
Subject: [PATCH] Port to hamcrest 2.1 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 +- src/main/java/org/junit/matchers/JUnitMatchers.java | 2 +-
.../experimental/theories/runner/WithDataPointMethod.java | 2 +- .../tests/experimental/theories/runner/WithDataPointMethod.java | 2 +-
5 files changed, 2 insertions(+), 9 deletions(-) 2 files changed, 2 insertions(+), 2 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<T extends Throwable> extends
return stringWriter.toString();
}
- @Factory
public static <T extends Throwable> Matcher<T> isThrowable(
Matcher<T> throwableMatcher) {
return new StacktracePrintingMatcher<T>(throwableMatcher);
}
- @Factory
public static <T extends Exception> Matcher<T> isException(
Matcher<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
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<T extends Throwable> extends
* @param matcher to apply to the cause of the outer exception
* @param <T> type of the outer exception
*/
- @Factory
public static <T extends Throwable> Matcher<T> hasCause(final Matcher<? extends Throwable> 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
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<T extends Throwable> extends
matcher.describeMismatch(item.getMessage(), description);
}
- @Factory
public static <T extends Throwable> Matcher<T> hasMessage(final Matcher<String> 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 13407cc..8889266 100644
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java --- a/src/main/java/org/junit/matchers/JUnitMatchers.java
@ -91,7 +22,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 c814508..ce22ef4 100644 index f2b2753..e5759ed 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 +35,5 @@ index c814508..ce22ef4 100644
} }
} }
-- --
2.21.0 2.24.1

View File

@ -1,90 +0,0 @@
From abb2895b7faf07817644e69e34701af6e88204e7 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Wed, 30 Oct 2019 17:16:11 +0100
Subject: [PATCH] Port to OpenJDK 11
---
.../junit/runners/model/TestClassTest.java | 3 ++
.../junit/tests/running/core/MainRunner.java | 31 -------------------
2 files changed, 3 insertions(+), 31 deletions(-)
diff --git a/src/test/java/org/junit/runners/model/TestClassTest.java b/src/test/java/org/junit/runners/model/TestClassTest.java
index 7682968..810de25 100644
--- a/src/test/java/org/junit/runners/model/TestClassTest.java
+++ b/src/test/java/org/junit/runners/model/TestClassTest.java
@@ -135,6 +135,9 @@ public class TestClassTest {
}
}
+ /// The class Object starting from JDK9 has its own annotations
+ /// which causes this test to fail
+ @Ignore
@Test
public void providesAnnotatedMethodsSortedByName() {
TestClass tc = new TestClass(MethodsAnnotated.class);
diff --git a/src/test/java/org/junit/tests/running/core/MainRunner.java b/src/test/java/org/junit/tests/running/core/MainRunner.java
index 31f01e8..076a212 100644
--- a/src/test/java/org/junit/tests/running/core/MainRunner.java
+++ b/src/test/java/org/junit/tests/running/core/MainRunner.java
@@ -39,11 +39,6 @@ public class MainRunner {
throw new ExitException(status);
}
- @Override
- public boolean getInCheck() {
- return (originalSecurityManager != null) && originalSecurityManager.getInCheck();
- }
-
@Override
public Object getSecurityContext() {
return (originalSecurityManager == null) ? super.getSecurityContext() : originalSecurityManager.getSecurityContext();
@@ -196,11 +191,6 @@ public class MainRunner {
}
}
- @Override
- public boolean checkTopLevelWindow(Object window) {
- return (originalSecurityManager == null) ? super.checkTopLevelWindow(window) : originalSecurityManager.checkTopLevelWindow(window);
- }
-
@Override
public void checkPrintJobAccess() {
if (originalSecurityManager != null) {
@@ -208,20 +198,6 @@ public class MainRunner {
}
}
- @Override
- public void checkSystemClipboardAccess() {
- if (originalSecurityManager != null) {
- originalSecurityManager.checkSystemClipboardAccess();
- }
- }
-
- @Override
- public void checkAwtEventQueueAccess() {
- if (originalSecurityManager != null) {
- originalSecurityManager.checkAwtEventQueueAccess();
- }
- }
-
@Override
public void checkPackageAccess(String pkg) {
if (originalSecurityManager != null) {
@@ -243,13 +219,6 @@ public class MainRunner {
}
}
- @Override
- public void checkMemberAccess(Class<?> clazz, int which) {
- if (originalSecurityManager != null) {
- originalSecurityManager.checkMemberAccess(clazz, which);
- }
- }
-
@Override
public void checkSecurityAccess(String target) {
if (originalSecurityManager != null) {
--
2.21.0

View File

@ -1,22 +0,0 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: ./create-tarball.sh VERSION"
exit 1
fi
VERSION=${1}
NAME="junit"
wget https://github.com/${NAME}-team/${NAME}/archive/r${VERSION}.tar.gz
tar xvf r${VERSION}.tar.gz
(
cd ${NAME}-r${VERSION}
find . -name "*.jar" -delete
find . -name "*.class" -delete
)
tar czvf ${NAME}-${VERSION}-clean.tar.gz ${NAME}-r${VERSION}
rm -Rf ${NAME}-${VERSION}.tar.gz

22
generate-tarball.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
name=junit
version="$(sed -n 's/Version:\s*//p' *.spec)"
# RETRIEVE
wget "https://github.com/junit-team/junit/archive/r${version}.tar.gz" -O "${name}-${version}.orig.tar.gz"
rm -rf tarball-tmp
mkdir tarball-tmp
pushd tarball-tmp
tar -xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
find -name '*.jar' -delete
find -name '*.class' -delete
rm -r "junit4-r${version}/src/site"
tar -czf "../${name}-${version}.tar.gz" *
popd
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"

View File

@ -1,24 +1,22 @@
Name: junit Name: junit
Version: 4.12 Version: 4.13
Release: 11%{?dist} Release: 1%{?dist}
Summary: Java regression test package Summary: Java regression test package
License: EPL-1.0 License: EPL-1.0
URL: http://www.junit.org/ URL: http://www.junit.org/
BuildArch: noarch BuildArch: noarch
# ./clean-tarball.sh %{version} # ./generate-tarball.sh
Source0: %{name}-%{version}-clean.tar.gz Source0: %{name}-%{version}.tar.gz
Source3: create-tarball.sh Source1: generate-tarball.sh
Patch1: 0001-Port-to-hamcrest-2.1.patch Patch1: 0001-Port-to-hamcrest-2.1.patch
Patch2: 0002-Port-to-OpenJDK-11.patch
BuildRequires: maven-local BuildRequires: maven-local
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin)
BuildRequires: mvn(org.hamcrest:hamcrest-core) BuildRequires: mvn(org.hamcrest:hamcrest-core)
%description %description
JUnit is a regression testing framework written by Erich Gamma and Kent Beck. JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
It is used by the developer who implements unit tests in Java. JUnit is Open It is used by the developer who implements unit tests in Java. JUnit is Open
@ -38,10 +36,13 @@ Summary: Javadoc for %{name}
Javadoc for %{name}. Javadoc for %{name}.
%prep %prep
%setup -q -n %{name}-r%{version} %setup -q -n junit4-r%{version}
%patch1 -p1 %patch1 -p1
%patch2 -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 # InaccessibleBaseClassTest fails with Java 8
sed -i /InaccessibleBaseClassTest/d src/test/java/org/junit/tests/AllTests.java sed -i /InaccessibleBaseClassTest/d src/test/java/org/junit/tests/AllTests.java
@ -90,6 +91,9 @@ sed s/@version@/%{version}/ src/main/java/junit/runner/Version.java.template >sr
%doc doc/* %doc doc/*
%changelog %changelog
* Fri Mar 06 2020 Marian Koncek <mkoncek@redhat.com> - 4.13-1
- Update to upstream version 4.13
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.12-11 * Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.12-11
- Mass rebuild for javapackages-tools 201902 - Mass rebuild for javapackages-tools 201902

View File

@ -1 +1 @@
SHA512 (junit-4.12-clean.tar.gz) = d25fc547aa8fd961a33e5104da899be924047dbe150bfe8cd1677648173f7bcab82b0562718fc8ec2138323b786bb6c66e749f96701871d8f1d8984dee52c2de SHA512 (junit-4.13.tar.gz) = 6cafdeed70435c1928767fbb3327a7c9e6d6869703c10696e404e6f1c3ececa3ef0c09bad50585c28f6b1ca5b17affcaa29e207b1d20e257e7f332d5fc3554bc