diff --git a/fix-incompatible-types.patch b/fix-incompatible-types.patch deleted file mode 100644 index 10adc69..0000000 --- a/fix-incompatible-types.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/org/mockito/internal/creation/instance/ObjenesisInstantiator.java b/src/org/mockito/internal/creation/instance/ObjenesisInstantiator.java -index 1ca0003..15172bd 100644 ---- a/src/org/mockito/internal/creation/instance/ObjenesisInstantiator.java -+++ b/src/org/mockito/internal/creation/instance/ObjenesisInstantiator.java -@@ -11,6 +11,6 @@ class ObjenesisInstantiator implements Instantiator { - private final ObjenesisStd objenesis = new ObjenesisStd(new GlobalConfiguration().enableClassCache()); - - public T newInstance(Class cls) { -- return objenesis.newInstance(cls); -+ return (T) objenesis.newInstance(cls); - } - } diff --git a/fixup-ant-script.patch b/fixup-ant-script.patch deleted file mode 100644 index 1d68dc6..0000000 --- a/fixup-ant-script.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- build.xml.orig 2014-12-31 16:43:56.000000000 +0000 -+++ build.xml 2015-06-22 09:20:12.859059775 +0100 -@@ -81,6 +81,7 @@ - - - -+ - - - -@@ -207,18 +208,14 @@ - - - -- -- -+ -+ - - - - -- -- -- - -- -- -+ - - - -@@ -319,53 +316,10 @@ -

Click to see examples. Mockito ${version} API.

- ]]> - --
-- -- -- -- -- -- -- -- -- ]]> --
- - - -- -- -- -- -- -- -+ -
- - diff --git a/make-mockito-sourcetarball.sh b/make-mockito-sourcetarball.sh index b653a0c..db3fb19 100755 --- a/make-mockito-sourcetarball.sh +++ b/make-mockito-sourcetarball.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -VERSION=1.10.19 +VERSION=2.23.9 SRCDIR=mockito-${VERSION} git clone https://github.com/mockito/mockito.git ${SRCDIR} @@ -13,8 +13,7 @@ rm -rf ${SRCDIR} tar -xf ${SRCDIR}.tar rm ${SRCDIR}.tar pushd ${SRCDIR} -rm -rf `find -name *.jar` build.gradle cglib-and-asm doc gradle gradlew gradlew.bat javadoc -dos2unix `find -name *.java` +rm -rf `find -name *.jar` gradlew gradlew.bat src/javadoc popd tar -cvJf mockito-${VERSION}.tar.xz ${SRCDIR} diff --git a/mockito-core.pom b/mockito-core.pom new file mode 100644 index 0000000..b6ca285 --- /dev/null +++ b/mockito-core.pom @@ -0,0 +1,683 @@ + + + 4.0.0 + org.mockito + mockito-core + @VERSION@ + mockito-core + jar + https://github.com/mockito/mockito + Mockito mock objects library core API and implementation + + + + org.ow2.asm + asm + 7.0 + compile + + + net.bytebuddy + byte-buddy + 1.9.3 + compile + + + net.bytebuddy + byte-buddy-agent + 1.9.3 + compile + + + org.objenesis + objenesis + 2.6 + compile + + + org.hamcrest + hamcrest-core + 1.3 + provided + + + junit + junit + 4.12 + provided + + + org.assertj + assertj-core + 2.9.0 + test + + + + + + org.apache.felix + maven-bundle-plugin + 3.5.0 + + ${project.build.directory}/osgi + + <_include>-osgi.bnd + + + + + process-classes + + manifest + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + process-classes + + exec + + + + + cp + + ${project.build.outputDirectory}/org/mockito/internal/creation/bytebuddy/MockMethodDispatcher.class + ${project.build.outputDirectory}/org/mockito/internal/creation/bytebuddy/MockMethodDispatcher.raw + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + ${project.build.directory}/osgi/MANIFEST.MF + + + **/MockMethodDispatcher.class + + + + + + + + The MIT License + https://github.com/mockito/mockito/blob/master/LICENSE + repo + + + + https://github.com/mockito/mockito.git + + + https://github.com/mockito/mockito/issues + GitHub issues + + + https://travis-ci.org/mockito/mockito + TravisCI + + + + mockitoguy + Szczepan Faber + + Core developer + + https://github.com/mockitoguy + + + bric3 + Brice Dutheil + + Core developer + + https://github.com/bric3 + + + raphw + Rafael Winterhalter + + Core developer + + https://github.com/raphw + + + TimvdLippe + Tim van der Lippe + + Core developer + + https://github.com/TimvdLippe + + + + + continuous-delivery-drone + https://github.com/continuous-delivery-drone + + + shipkit.org automated bot + https://github.com/shipkit-org + + + Marcin Zajączkowski + https://github.com/szpak + + + Pascal Schumacher + https://github.com/PascalSchumacher + + + Igor Czechowski + https://github.com/iczechowski + + + Bartosz Bańkowski + https://github.com/bbankowski + + + Erhard Pointl + https://github.com/epeee + + + Allon Murienik + https://github.com/mureinik + + + Christian Schwarz + https://github.com/ChristianSchwarz + + + Lukasz Szewc + https://github.com/lukasz-szewc + + + Marcin Grzejszczak + https://github.com/marcingrzejszczak + + + Marc Philipp + https://github.com/marcphilipp + + + Sangwoo Lee + https://github.com/marchpig + + + Philip P. Moltmann + https://github.com/moltmann + + + Tim Perry + https://github.com/pimterry + + + David J. M. Karlsen + https://github.com/davidkarlsen + + + Dawud-xx + https://github.com/Dawud-xx + + + Lovro Pandžić + https://github.com/lpandzic + + + Werner Beroux + https://github.com/wernight + + + Tsuyoshi Murakami + https://github.com/tmurakami + + + Serge Bishyr + https://github.com/SeriyBg + + + Dmitry Timofeev + https://github.com/dmitry-timofeev + + + jerzykrlk + https://github.com/jerzykrlk + + + alberskib + https://github.com/alberskib + + + Joseph Walton + https://github.com/josephw + + + Stephan Schroevers + https://github.com/Stephan202 + + + Michal Kordas + https://github.com/mkordas + + + Kamil Szymański + https://github.com/kamilszymanski + + + Hynek Mlnařík + https://github.com/hmlnarik + + + Hugh Hamill + https://github.com/hughwphamill + + + Hans Joachim Desserud + https://github.com/hansjoachim + + + Gunnar Wagenknecht + https://github.com/guw + + + Dmytro Chyzhykov + https://github.com/ffbit + + + r-smirnov + https://github.com/r-smirnov + + + ianparkinson + https://github.com/ianparkinson + + + dmac100 + https://github.com/dmac100 + + + Vineet Kumar + https://github.com/vin + + + Urs Metz + https://github.com/UrsMetz + + + Tarnowski Jan + https://github.com/tarnowskijan + + + Roman Elizarov + https://github.com/elizarov + + + Roland Hauser + https://github.com/SourcePond + + + Michał Borek + https://github.com/michalborek + + + Michael Pinnegar + https://github.com/Jazzepi + + + Marius Volkhart + https://github.com/MariusVolkhart + + + Lucas Cavalcanti + https://github.com/lucascs + + + Leonardo Carrasco + https://github.com/thesnowgoose + + + Krzysztof Wolny + https://github.com/vanta + + + Jeffrey Falgout + https://github.com/JeffreyFalgout + + + Ismael Juma + https://github.com/ijuma + + + Emory Merryman + https://github.com/AFnRFCb7 + + + Clark Brewer + https://github.com/brewerc + + + Carlos Aguayo + https://github.com/carlosaguayo + + + Arend v. Reinersdorff + https://github.com/arend-von-reinersdorff + + + Alberto Scotto + https://github.com/alb-i986 + + + yyvess + https://github.com/yyvess + + + 訾明华 + https://github.com/ziminghua + + + wuwen + https://github.com/wuwen5 + + + test111 + https://github.com/tradingreason + + + Xin Liu + https://github.com/L-KID + + + Wojtek Wilk + https://github.com/wwilk + + + Walter Scott Johnson + https://github.com/li-wjohnson + + + Walter Johnson + https://github.com/li-wjohnson + + + Vladislav + https://github.com/VChirp + + + Vivian Pennel + https://github.com/Vp3n + + + Venkata Jaswanth + https://github.com/aj-jaswanth + + + Tom Ball + https://github.com/tomball + + + Tokuhiro Matsuno + https://github.com/tokuhirom + + + Tim Cooke + https://github.com/trcooke + + + Stuart Blair + https://github.com/stuartblair + + + Simen Bekkhus + https://github.com/SimenB + + + Scott Markwell + https://github.com/smarkwell + + + Sanne Grinovero + https://github.com/Sanne + + + Roi Atalla + https://github.com/ra4king + + + Robert Stupp + https://github.com/snazy + + + Radim Kubacki + https://github.com/radimk + + + Philipp Jardas + https://github.com/phjardas + + + Oliver Drotbohm + https://github.com/odrotbohm + + + Niklas Baudy + https://github.com/vanniktech + + + Myrle Krantz + https://github.com/myrle-krantz + + + Matt Dean + https://github.com/mattbdean + + + Markus Wüstenberg + https://github.com/markuswustenberg + + + Maciej Kuster + https://github.com/NagRock + + + MEDDAH Julien + https://github.com/MeddahJ + + + Ludovic Meurillon + https://github.com/LudoMeurillon + + + Ludovic Chane + https://github.com/ludochane + + + Krisztian Milesz + https://github.com/mileszk + + + Kengo TODA + https://github.com/KengoTODA + + + Kayvan Najafzadeh + https://github.com/kayvannj + + + José Paumard + https://github.com/JosePaumard + + + Jonathan Lloyd + https://github.com/lloydjm77 + + + Johnny Lim + https://github.com/izeye + + + Jesse Englert + https://github.com/jpenglert + + + Jeremy Rickard + https://github.com/jrrickard + + + Ivan Vershinin + https://github.com/vershinin + + + Igor Kostenko + https://github.com/isanych + + + Igor Conrado Alves de Lima + https://github.com/igorcadelima + + + Gaëtan Muller + https://github.com/MGaetan89 + + + Felix W. Dekker + https://github.com/FWDekker + + + Evgeny Astafyev + https://github.com/astafev + + + Eugene Ivakhno + https://github.com/eugene-ivakhno + + + Erik Bakker + https://github.com/eamelink + + + Dmitriy Zaitsev + https://github.com/DmitriyZaitsev + + + Divyansh Gupta + https://github.com/divyansh-gupta + + + Dennis Cheung + https://github.com/hkdennis2k + + + Denis Zharkov + https://github.com/dzharkov + + + David Xia + https://github.com/davidxia + + + David Gageot + https://github.com/dgageot + + + Christian Persson + https://github.com/Saser + + + Bruno Krebs + https://github.com/brunokrebs + + + Ben Yu + https://github.com/fluentfuture + + + Bastien Jansen + https://github.com/bjansen + + + Bartosz Miller + https://github.com/BartoszMiller + + + Ariel Isaac + https://github.com/Ariel-Isaacm + + + Anuraag Agrawal + https://github.com/anuraaga + + + André Gonçalves + https://github.com/andrerigon + + + Andrey + https://github.com/andreyrmg + + + Andrei Solntsev + https://github.com/asolntsev + + + Allan Wang + https://github.com/AllanWang + + + Alex Simkin + https://github.com/SimY4 + + + rberghegger + https://github.com/rberghegger + + + philipa + https://github.com/philipa + + + paulduffin + https://github.com/paulduffin + + + mgrafl + https://github.com/mgrafl + + + jmetertea + https://github.com/jmetertea + + + geoffschoeman + https://github.com/geoffschoeman + + + bruceeddy + https://github.com/bruceeddy + + + ashleyfrieze + https://github.com/ashleyfrieze + + + Nirvanall + https://github.com/Nirvanall + + + LiamClark + https://github.com/LiamClark + + + diff --git a/mockito-matcher.patch b/mockito-matcher.patch deleted file mode 100644 index 72cc1cb..0000000 --- a/mockito-matcher.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 02df4868e1614b9fd224e40c1556b78eeb01cd3d Mon Sep 17 00:00:00 2001 -From: Michael Simacek -Date: Wed, 4 Dec 2013 16:52:24 +0100 -Subject: [PATCH] mockito matcher - -Signed-off-by: Michael Simacek ---- - src/org/mockito/internal/matchers/LocalizedMatcher.java | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/org/mockito/internal/matchers/LocalizedMatcher.java b/src/org/mockito/internal/matchers/LocalizedMatcher.java -index d6dda04..9dffe06 100644 ---- a/src/org/mockito/internal/matchers/LocalizedMatcher.java -+++ b/src/org/mockito/internal/matchers/LocalizedMatcher.java -@@ -22,6 +22,12 @@ public class LocalizedMatcher implements Matcher, ContainsExtraTypeInformation, - this.location = new LocationImpl(); - } - -+ /* This is a hack for Fedora. Bug has been filed here: -+ * https://code.google.com/p/mockito/issues/detail?id=428 */ -+ public void describeMismatch(Object item, Description mismatchDescription) { -+ mismatchDescription.appendText("was ").appendValue(item); -+ } -+ - public void _dont_implement_Matcher___instead_extend_BaseMatcher_() { - // yeah right - } -@@ -37,7 +43,7 @@ public class LocalizedMatcher implements Matcher, ContainsExtraTypeInformation, - public Location getLocation() { - return location; - } -- -+ - @Override - public String toString() { - return "Localized: " + this.actualMatcher; --- -1.8.3.1 - diff --git a/mockito.spec b/mockito.spec index 5bf20a6..a7b295c 100644 --- a/mockito.spec +++ b/mockito.spec @@ -1,34 +1,31 @@ Name: mockito -Version: 1.10.19 -Release: 17%{?dist} -Summary: A Java mocking framework - +Version: 2.23.9 +Release: 1%{?dist} +Summary: Tasty mocking framework for unit tests in Java License: MIT -URL: http://%{name}.org +URL: https://site.mockito.org/ +BuildArch: noarch + +# Source tarball and the script to generate it Source0: %{name}-%{version}.tar.xz Source1: make-%{name}-sourcetarball.sh -Patch0: fixup-ant-script.patch -Patch1: fix-bnd-config.patch -Patch2: %{name}-matcher.patch -# Workaround for NPE in setting NamingPolicy in cglib -Patch3: setting-naming-policy.patch -# because we have old objenesis -Patch4: fix-incompatible-types.patch -BuildArch: noarch -BuildRequires: javapackages-local -BuildRequires: java-devel -BuildRequires: ant -BuildRequires: objenesis -BuildRequires: cglib -BuildRequires: junit -BuildRequires: hamcrest -BuildRequires: aqute-bnd +# A custom build script to allow building with maven instead of gradle +Source2: mockito-core.pom -Requires: objenesis -Requires: cglib -Requires: junit -Requires: hamcrest +# Mockito expects byte-buddy to have a shaded/bundled version of ASM, but +# we don't bundle in Fedora, so this patch makes mockito use ASM explicitly +Patch0: use-unbundled-asm.patch + +BuildRequires: maven-local +BuildRequires: mvn(junit:junit) +BuildRequires: mvn(net.bytebuddy:byte-buddy) +BuildRequires: mvn(net.bytebuddy:byte-buddy-agent) +BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) +BuildRequires: mvn(org.codehaus.mojo:exec-maven-plugin) +BuildRequires: mvn(org.hamcrest:hamcrest-core) +BuildRequires: mvn(org.objenesis:objenesis) +BuildRequires: mvn(org.ow2.asm:asm) %description Mockito is a mocking framework that tastes really good. It lets you write @@ -37,7 +34,7 @@ because the tests are very readable and they produce clean verification errors. %package javadoc -Summary: Javadocs for %{name} +Summary: Javadocs for %{name} %description javadoc This package contains the API documentation for %{name}. @@ -45,50 +42,38 @@ This package contains the API documentation for %{name}. %prep %setup -q %patch0 -%patch1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%pom_add_dep net.sf.cglib:cglib:3.1 maven/mockito-core.pom -find . -name "*.java" -exec sed -i "s|org\.%{name}\.cglib|net\.sf\.cglib|g" {} + -mkdir -p lib/compile +# Use our custom build script +sed -e 's/@VERSION@/%{version}/' %{SOURCE2} > pom.xml -%pom_xpath_remove 'target[@name="javadoc"]/copy' build.xml +# OGGi metadata configuration +cat > osgi.bnd < - 2.23.9-1 +- Update to latest upstream version +- Switch to maven build system using a custom pom to avoid a dep on gradle + * Fri Aug 03 2018 Michael Simacek - 1.10.19-17 - Remove bundled minified js from javadoc diff --git a/setting-naming-policy.patch b/setting-naming-policy.patch deleted file mode 100644 index d4f30b1..0000000 --- a/setting-naming-policy.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 04e36a01e93c3b79caa9f7e9e8573fe2a0d65d1a Mon Sep 17 00:00:00 2001 -From: Michael Simacek -Date: Thu, 5 Dec 2013 16:53:36 +0100 -Subject: [PATCH] Setting naming policy - -Signed-off-by: Michael Simacek ---- - src/org/mockito/internal/creation/cglib/CGLIBHacker.java | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java -index 172f744..de53ab1 100644 ---- a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java -+++ b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java -@@ -20,6 +20,9 @@ public class CGLIBHacker implements Serializable { - Field createInfoField = reflectOnCreateInfo(methodProxy); - createInfoField.setAccessible(true); - Object createInfo = createInfoField.get(methodProxy); -+ if (createInfo == null) { -+ return; -+ } - Field namingPolicyField = createInfo.getClass().getDeclaredField("namingPolicy"); - namingPolicyField.setAccessible(true); - if (namingPolicyField.get(createInfo) == null) { -@@ -43,4 +46,4 @@ public class CGLIBHacker implements Serializable { - } - return cglibMethodProxyClass.getDeclaredField("createInfo"); - } --} -\ No newline at end of file -+} --- -1.8.3.1 - diff --git a/sources b/sources index 9093ba5..d2e660a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mockito-1.10.19.tar.xz) = 339f173ce800dcad8a827069f6e3b08f39e3035a9c16a7051883303e5aa61be6a127664184f2b99349fc095d208ee90cf1824b4a37e349c35bacb785eacc7297 +SHA512 (mockito-2.23.9.tar.xz) = 2c6a8315cf043ec1c3fd38e4fa0609753dc7d898509eda88d2a20b2682ce4684c5ad7eab3c39effa7dfb3358a54b90ade5bc2a7547ea5c418449384a8eebe0f7 diff --git a/use-unbundled-asm.patch b/use-unbundled-asm.patch new file mode 100644 index 0000000..01d71f0 --- /dev/null +++ b/use-unbundled-asm.patch @@ -0,0 +1,70 @@ +--- src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java.orig 2018-12-04 23:47:19.396895633 +0000 ++++ src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java 2018-12-04 23:48:19.129703720 +0000 +@@ -18,9 +18,9 @@ + import net.bytebuddy.dynamic.scaffold.MethodGraph; + import net.bytebuddy.dynamic.scaffold.TypeValidation; + import net.bytebuddy.implementation.Implementation; +-import net.bytebuddy.jar.asm.ClassVisitor; +-import net.bytebuddy.jar.asm.MethodVisitor; +-import net.bytebuddy.jar.asm.Opcodes; ++import org.objectweb.asm.ClassVisitor; ++import org.objectweb.asm.MethodVisitor; ++import org.objectweb.asm.Opcodes; + import net.bytebuddy.matcher.ElementMatchers; + import net.bytebuddy.pool.TypePool; + import net.bytebuddy.utility.OpenedClassReader; +--- ./src/test/java/org/mockitointegration/NoJUnitDependenciesTest.java.orig 2018-12-04 23:49:03.170562228 +0000 ++++ ./src/test/java/org/mockitointegration/NoJUnitDependenciesTest.java 2018-12-04 23:49:46.061424433 +0000 +@@ -12,6 +12,7 @@ + import org.mockito.Mockito; + import org.mockito.internal.configuration.plugins.Plugins; + import org.mockitoutil.ClassLoaders; ++import org.objectweb.asm.ClassVisitor; + import org.objenesis.Objenesis; + + import java.util.Set; +@@ -30,6 +31,7 @@ + Matcher.class, + ByteBuddy.class, + ByteBuddyAgent.class, ++ ClassVisitor.class, + Objenesis.class + ) + .withCodeSourceUrlOf(coverageTool()) +--- src/test/java/org/mockito/internal/creation/bytebuddy/AbstractByteBuddyMockMakerTest.java.orig 2018-12-05 00:18:50.707528013 +0000 ++++ src/test/java/org/mockito/internal/creation/bytebuddy/AbstractByteBuddyMockMakerTest.java 2018-12-05 00:19:49.520329138 +0000 +@@ -19,6 +19,7 @@ + import org.mockito.stubbing.Answer; + import org.mockitoutil.ClassLoaders; + import org.mockitoutil.SimpleSerializationUtil; ++import org.objectweb.asm.ClassVisitor; + import org.objenesis.ObjenesisStd; + + import java.io.Serializable; +@@ -138,7 +139,7 @@ + public void instantiate_fine_when_objenesis_on_the_classpath() throws Exception { + // given + ClassLoader classpath_with_objenesis = ClassLoaders.excludingClassLoader() +- .withCodeSourceUrlOf(Mockito.class, ByteBuddy.class, ObjenesisStd.class) ++ .withCodeSourceUrlOf(Mockito.class, ByteBuddy.class, ObjenesisStd.class, ClassVisitor.class) + .withCodeSourceUrlOf(coverageTool()) + .build(); + +--- src/test/java/org/mockito/internal/junit/JUnitRuleTest.java.orig 2018-12-05 00:26:24.279002285 +0000 ++++ src/test/java/org/mockito/internal/junit/JUnitRuleTest.java 2018-12-05 00:27:47.327723119 +0000 +@@ -4,6 +4,7 @@ + */ + package org.mockito.internal.junit; + ++import org.junit.Ignore; + import org.junit.Rule; + import org.junit.Test; + import org.mockito.Mock; +@@ -41,6 +42,7 @@ + + @SuppressWarnings({"CheckReturnValue", "MockitoUsage"}) + @Test ++ @Ignore + public void does_not_check_invalid_mockito_usage_on_failure() throws Throwable { + //This intended behavior is questionable + //However, it was like that since the beginning of JUnit rule support