[SCM] jmock2 - Java library for testing code with mock objects branch, master, updated. upstream/2.5.1+dfsg-4-gacbbc8d
Damien Raude-Morvan
drazzib at debian.org
Thu Jul 19 22:37:02 UTC 2012
The following commit has been merged in the master branch:
commit acbbc8d219e00f1219f49b9fc6e86e8f8b85d1eb
Author: Damien Raude-Morvan <drazzib at debian.org>
Date: Wed Jul 18 19:58:09 2012 +0200
Team upload.
* Team upload.
* Fix FTBFS with new Hamcrest 1.2.
diff --git a/debian/changelog b/debian/changelog
index 8cd4a9d..d4790f8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+jmock2 (2.5.1+dfsg-2) unstable; urgency=low
+
+ * Team upload.
+ * Fix FTBFS with new libhamcrest-java >= 1.2 by backporting upstream changes
+ from 2.6.x release (Closes: #662811).
+ * d/control: Bump Standards-Version to 3.9.3: no changes needed.
+ * d/copyright: Upgrade from DEP5 to copyright format 1.0.
+ * d/control: Remove Depends on JRE as per Java Policy.
+
+ -- Damien Raude-Morvan <drazzib at debian.org> Wed, 18 Jul 2012 19:56:57 +0200
+
jmock2 (2.5.1+dfsg-1) unstable; urgency=low
* Initial release. (Closes: #573803)
diff --git a/debian/control b/debian/control
index 46838d9..d069bda 100644
--- a/debian/control
+++ b/debian/control
@@ -5,17 +5,16 @@ Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.or
Uploaders: Gabriele Giacone <1o5g4r8o at gmail.com>
Build-Depends: debhelper (>> 7), javahelper (>= 0.29), ant, cdbs, ant-optional,
maven-repo-helper
-Build-Depends-Indep: default-jdk, libhamcrest-java, libcglib-java, libasm3-java,
+Build-Depends-Indep: default-jdk, libhamcrest-java (>= 1.2), libcglib-java, libasm3-java,
junit4, bsh, libobjenesis-java
-Standards-Version: 3.8.4
+Standards-Version: 3.9.3
Vcs-Git: git://git.debian.org/pkg-java/jmock2.git
Vcs-Browser: http://git.debian.org/?p=pkg-java/jmock2.git
Homepage: http://www.jmock.org/
Package: libjmock2-java
Architecture: all
-Depends: default-jre-headless | java2-runtime-headless, ${java:Depends},
- ${misc:Depends}, libcglib-java, libobjenesis-java
+Depends: ${java:Depends}, ${misc:Depends}, libcglib-java, libobjenesis-java
Description: Java library for testing code with mock objects
Mock objects help you design and test the interactions between the objects in
your programs.
diff --git a/debian/copyright b/debian/copyright
index a420ead..83f481d 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,9 +1,10 @@
-Format-Specification: http://dep.debian.net/deps/dep5/
-Name: jMock2
-Maintainer: Steve Freeman, Tim Mackinnon, Nat Pryce, Mauro Talevi, Joe Walnes
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: jMock2
+Upstream-Contact: Steve Freeman, Tim Mackinnon, Nat Pryce, Mauro Talevi, Joe Walnes
<http://dir.gmane.org/gmane.comp.java.jmock.devel>
Source: http://svn.codehaus.org/jmock/
+Files: *
Copyright: 2000-2007, jMock.org
License: BSD
On Debian GNU/Linux system you can find the complete text of the
diff --git a/debian/libjmock2-java-doc.doc-base.javadoc b/debian/libjmock2-java-doc.doc-base.javadoc
index 3374ae8..48ea80a 100644
--- a/debian/libjmock2-java-doc.doc-base.javadoc
+++ b/debian/libjmock2-java-doc.doc-base.javadoc
@@ -2,7 +2,7 @@ Document: libjmock2-java-doc
Title: API JavaDoc for libjmock2-java-doc
Author:
Abstract: This the API JavaDoc for libjmock2-java-doc
-Section: Programming
+Section: Programming/Java
Format: HTML
Index: /usr/share/doc/libjmock2-java-doc/api
diff --git a/debian/patches/05hamcrest12.diff b/debian/patches/05hamcrest12.diff
new file mode 100644
index 0000000..682ac58
--- /dev/null
+++ b/debian/patches/05hamcrest12.diff
@@ -0,0 +1,294 @@
+Description: Change API to support Hamcrest 1.2
+ Backport changes from upstream JMock 2.6.0
+Author: Damien Raude-Morvan <drazzib at debian.org>
+Last-Update: 2012-07-18
+Forwarded: not-needed
+--- a/src/org/jmock/Expectations.java
++++ b/src/org/jmock/Expectations.java
+@@ -184,39 +184,48 @@
+ }
+
+ public boolean with(boolean value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return false;
+ }
+
+ public byte with(byte value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public short with(short value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public char with(char value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public int with(int value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public long with(long value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public float with(float value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public double with(double value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return 0;
+ }
+
+ public <T> T with(T value) {
+- return with(equalTo(value));
++ addParameterMatcher(equal(value));
++ return value;
+ }
+
+ public void will(Action action) {
+--- a/src/org/jmock/internal/InvocationExpectation.java
++++ b/src/org/jmock/internal/InvocationExpectation.java
+@@ -10,6 +10,7 @@
+ import org.jmock.api.Action;
+ import org.jmock.api.Expectation;
+ import org.jmock.api.Invocation;
++import org.jmock.internal.matcher.MethodMatcher;
+ import org.jmock.lib.action.VoidAction;
+
+ /**
+@@ -19,10 +20,11 @@
+ * @author smgf
+ */
+ public class InvocationExpectation implements Expectation {
++ private static ParametersMatcher ANY_PARAMETERS = new AnyParametersMatcher();
+ private Cardinality cardinality = Cardinality.ALLOWING;
+ private Matcher<?> objectMatcher = IsAnything.anything();
+- private Matcher<Method> methodMatcher = IsAnything.anything("<any method>");
+- private Matcher<Object[]> parametersMatcher = IsAnything.anything("(<any parameters>)");
++ private Matcher<? super Method> methodMatcher = IsAnything.anything("<any method>");
++ private ParametersMatcher parametersMatcher = ANY_PARAMETERS;
+ private Action action = new VoidAction();
+ private List<OrderingConstraint> orderingConstraints = new ArrayList<OrderingConstraint>();
+ private List<SideEffect> sideEffects = new ArrayList<SideEffect>();
+@@ -36,12 +38,16 @@
+ public void setObjectMatcher(Matcher<?> objectMatcher) {
+ this.objectMatcher = objectMatcher;
+ }
++
++ public void setMethod(Method method) {
++ this.methodMatcher = new MethodMatcher(method);
++ }
+
+- public void setMethodMatcher(Matcher<Method> methodMatcher) {
+- this.methodMatcher = methodMatcher;
++ public void setMethodMatcher(Matcher<? super Method> matcher) {
++ this.methodMatcher = matcher;
+ }
+
+- public void setParametersMatcher(Matcher<Object[]> parametersMatcher) {
++ public void setParametersMatcher(ParametersMatcher parametersMatcher) {
+ this.parametersMatcher = parametersMatcher;
+ }
+
+@@ -121,4 +127,14 @@
+ sideEffect.perform();
+ }
+ }
++
++ private static class AnyParametersMatcher extends IsAnything<Object[]> implements ParametersMatcher {
++ public AnyParametersMatcher() {
++ super("(<any parameters>)");
++ }
++
++ public boolean isCompatibleWith(Object[] parameters) {
++ return true;
++ }
++ };
+ }
+--- a/src/org/jmock/internal/InvocationExpectationBuilder.java
++++ b/src/org/jmock/internal/InvocationExpectationBuilder.java
+@@ -10,10 +10,9 @@
+ import org.jmock.api.Action;
+ import org.jmock.api.Expectation;
+ import org.jmock.api.Invocation;
+-import org.jmock.internal.matcher.MethodMatcher;
+ import org.jmock.internal.matcher.MethodNameMatcher;
+ import org.jmock.internal.matcher.MockObjectMatcher;
+-import org.jmock.internal.matcher.ParametersMatcher;
++import org.jmock.internal.matcher.AllParametersMatcher;
+ import org.jmock.syntax.MethodClause;
+ import org.jmock.syntax.ParametersClause;
+ import org.jmock.syntax.ReceiverClause;
+@@ -83,14 +82,14 @@
+ }
+
+ public void createExpectationFrom(Invocation invocation) {
+- expectation.setMethodMatcher(new MethodMatcher(invocation.getInvokedMethod()));
++ expectation.setMethod(invocation.getInvokedMethod());
+
+ if (capturedParameterMatchers.isEmpty()) {
+- expectation.setParametersMatcher(new ParametersMatcher(invocation.getParametersAsArray()));
++ expectation.setParametersMatcher(new AllParametersMatcher(invocation.getParametersAsArray()));
+ }
+ else {
+ checkParameterMatcherCount(invocation);
+- expectation.setParametersMatcher(new ParametersMatcher(capturedParameterMatchers));
++ expectation.setParametersMatcher(new AllParametersMatcher(capturedParameterMatchers));
+ }
+ }
+
+@@ -130,7 +129,7 @@
+ }
+
+ public void with(Matcher<?>... parameterMatchers) {
+- expectation.setParametersMatcher(new ParametersMatcher(Arrays.asList(parameterMatchers)));
++ expectation.setParametersMatcher(new AllParametersMatcher(Arrays.asList(parameterMatchers)));
+ }
+
+ public void withNoArguments() {
+--- /dev/null
++++ b/src/org/jmock/internal/ParametersMatcher.java
+@@ -0,0 +1,12 @@
++package org.jmock.internal;
++
++import org.hamcrest.Matcher;
++
++public interface ParametersMatcher extends Matcher<Object[]> {
++ /**
++ * Is this matcher likely to be relevant to the given parameters?
++ * @param parameters The parameters to be matched
++ * @return true iff the parameters may be relevant.
++ */
++ boolean isCompatibleWith(Object[] parameters);
++}
+--- /dev/null
++++ b/src/org/jmock/internal/matcher/AllParametersMatcher.java
+@@ -0,0 +1,80 @@
++package org.jmock.internal.matcher;
++
++import static java.util.Arrays.asList;
++
++import java.util.List;
++
++import org.hamcrest.Description;
++import org.hamcrest.Matcher;
++import org.hamcrest.TypeSafeDiagnosingMatcher;
++import org.hamcrest.core.IsEqual;
++import org.jmock.internal.ParametersMatcher;
++
++public class AllParametersMatcher extends TypeSafeDiagnosingMatcher<Object[]> implements ParametersMatcher {
++ private final Matcher<Object>[] elementMatchers;
++
++ public AllParametersMatcher(Object[] expectedValues) {
++ this.elementMatchers = equalMatchersFor(expectedValues);
++ }
++
++ @SuppressWarnings("unchecked")
++ public AllParametersMatcher(List<Matcher<?>> parameterMatchers) {
++ this.elementMatchers = parameterMatchers.toArray(new Matcher[0]);
++ }
++
++ public boolean isCompatibleWith(Object[] parameters) {
++ return elementMatchers.length == parameters.length;
++ }
++
++ @Override
++ public boolean matchesSafely(Object[] parameters, Description mismatch) {
++ return matchesNumberOfParameters(parameters, mismatch)
++ && matchesParameters(parameters, mismatch);
++ }
++
++ private boolean matchesNumberOfParameters(Object[] parameters, Description mismatch) {
++ if (elementMatchers.length != parameters.length) {
++ mismatch.appendText("wrong number of parameters: ")
++ .appendValue(parameters);
++ return false;
++ }
++ return true;
++ }
++
++ private boolean matchesParameters(Object[] parameters, Description mismatch) {
++ boolean result = true;
++ for (int i = 0; i < parameters.length; i++) {
++ result &= matchesParameter(parameters[i], elementMatchers[i], mismatch, i);
++ }
++ return result;
++ }
++
++ private boolean matchesParameter(final Object value, final Matcher<Object> matcher, Description mismatch, int index) {
++ mismatch.appendText("\n parameter " + index + " ");
++ final boolean parameterMatches = matcher.matches(value);
++ if (parameterMatches) {
++ mismatch.appendText("matched: ").appendDescriptionOf(matcher);
++ } else {
++ mismatch.appendText("did not match: ")
++ .appendDescriptionOf(matcher)
++ .appendText(", because ");
++ matcher.describeMismatch(value, mismatch);
++ }
++ return parameterMatches;
++ }
++
++ public void describeTo(Description description) {
++ description.appendList("(", ", ",")", asList(elementMatchers));
++ }
++
++ @SuppressWarnings("unchecked")
++ private static Matcher<Object>[] equalMatchersFor(Object[] expectedValues) {
++ Matcher<Object>[] matchers = new Matcher[expectedValues.length];
++ for (int i = 0; i < expectedValues.length; i++) {
++ matchers[i] = new IsEqual<Object>(expectedValues[i]);
++ }
++ return matchers;
++ }
++
++}
++
+--- a/test/org/jmock/test/acceptance/HamcrestTypeSafetyAcceptanceTests.java
++++ b/test/org/jmock/test/acceptance/HamcrestTypeSafetyAcceptanceTests.java
+@@ -1,7 +1,7 @@
+ package org.jmock.test.acceptance;
+
+-import static org.hamcrest.number.OrderingComparisons.greaterThan;
+-import static org.hamcrest.text.StringStartsWith.startsWith;
++import static org.hamcrest.CoreMatchers.startsWith;
++import static org.hamcrest.number.OrderingComparison.greaterThan;
+
+ import java.lang.reflect.Method;
+
+--- a/test/org/jmock/test/unit/internal/InvocationExpectationTests.java
++++ b/test/org/jmock/test/unit/internal/InvocationExpectationTests.java
+@@ -16,6 +16,7 @@
+ import org.jmock.internal.InvocationExpectation;
+ import org.jmock.internal.OrderingConstraint;
+ import org.jmock.internal.SideEffect;
++import org.jmock.internal.matcher.AllParametersMatcher;
+ import org.jmock.lib.action.ReturnValueAction;
+ import org.jmock.test.unit.support.AssertThat;
+ import org.jmock.test.unit.support.MethodFactory;
+@@ -72,7 +73,7 @@
+ Object[] differentArgCount = {1,2,3};
+ Object[] noArgs = null;
+
+- expectation.setParametersMatcher(equalTo(args));
++ expectation.setParametersMatcher(new AllParametersMatcher(args));
+
+ assertTrue("should match", expectation.matches(new Invocation(targetObject, method, args)));
+ assertTrue("should not match", !expectation.matches(new Invocation(targetObject, method, differentArgs)));
diff --git a/debian/patches/series b/debian/patches/series
index c522eeb..fc13b14 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
02buildwithcglib2.2
03runtestsagainstsyslibs
04javadoc
+05hamcrest12.diff
--
jmock2 - Java library for testing code with mock objects
More information about the pkg-java-commits
mailing list