* [gentoo-commits] repo/gentoo:master commit in: dev-java/easymock/, dev-java/easymock/files/
@ 2022-10-04 9:40 Florian Schmaus
0 siblings, 0 replies; only message in thread
From: Florian Schmaus @ 2022-10-04 9:40 UTC (permalink / raw
To: gentoo-commits
commit: 15697e114bf8ba229627f43891d67d065778fc3b
Author: Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
AuthorDate: Sun Sep 11 11:20:40 2022 +0000
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Tue Oct 4 09:38:38 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15697e11
dev-java/easymock: add 2.5.2
Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
dev-java/easymock/Manifest | 1 +
dev-java/easymock/easymock-2.5.2.ebuild | 57 +++
.../easymock/files/easymock-2.5.5-nameClash.patch | 230 +++++++++++
.../files/easymock-2.5.5-tests2nameClash.patch | 420 +++++++++++++++++++++
4 files changed, 708 insertions(+)
diff --git a/dev-java/easymock/Manifest b/dev-java/easymock/Manifest
index d534942235a7..36d55f52bdad 100644
--- a/dev-java/easymock/Manifest
+++ b/dev-java/easymock/Manifest
@@ -1 +1,2 @@
+DIST easymock-2.5.2.tar.gz 100112 BLAKE2B 2952aad1a88b169413152e8fa63eaba85767d93ccd8535e309cb647b90ad86695da59c394d1199abfb6f1c624913b2546f326ae5a68092261968d734d2018c5c SHA512 0343815f74258739ac60e1ef2fe72a0e9ce0e1b6ecd4f14d657d7da2a10523e24df5160533b0d75e87ffa0322a3477ec6823b257fe5968929d55dee9dfa68267
DIST easymock-3.3.1.tar.gz 624460 BLAKE2B bb5a472aef6c162d3afe5b66edef4891cc48fe6698c1f1eccc7f45f1883ff7f940b0479af5c0dd61b3354b41225ca50f191ba54b92479362a0074ddf3dbb5b43 SHA512 93fefd458a42b6c13d85ab1df768bf906620f052eea88116e93578374a5086eb8b27d8731e82b689dc3d73699e45d03b718c7d8bf2a430ac4a6a717365e52a9a
diff --git a/dev-java/easymock/easymock-2.5.2.ebuild b/dev-java/easymock/easymock-2.5.2.ebuild
new file mode 100644
index 000000000000..44d36338c51a
--- /dev/null
+++ b/dev-java/easymock/easymock-2.5.2.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Skeleton command:
+# java-ebuilder --generate-ebuild --workdir . --pom pom.xml --download-uri https://github.com/easymock/easymock/archive/easymock-2.5.2.tar.gz --slot 2.5 --keywords "~amd64" --ebuild easymock-2.5.2.ebuild
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+MAVEN_ID="org.easymock:easymock:2.5.2"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple
+
+DESCRIPTION="Mock Objects for interfaces in JUnit tests by generating them on the fly"
+HOMEPAGE="https://easymock.org"
+SRC_URI="https://github.com/easymock/easymock/archive/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="2.5"
+KEYWORDS="~amd64"
+
+DEPEND=">=virtual/jdk-1.8:*"
+RDEPEND=">=virtual/jre-1.8:*"
+
+PATCHES=(
+ "${FILESDIR}/easymock-2.5.5-nameClash.patch"
+ "${FILESDIR}/easymock-2.5.5-tests2nameClash.patch"
+)
+
+S="${WORKDIR}/easymock-easymock-${PV}"
+
+JAVA_SRC_DIR="src/main/java"
+
+JAVA_TEST_GENTOO_CLASSPATH="junit-4"
+JAVA_TEST_SRC_DIR="src/test/java"
+JAVA_TEST_RESOURCE_DIRS="src/test/resources"
+
+src_prepare() {
+ default # https://bugs.gentoo.org/780585
+ # 1) testGetInstance(org.easymock.tests2.EasyMockPropertiesTest)
+ # java.lang.AssertionError: expected:<1> but was:<null>
+ sed \
+ -e '/import org.junit.Test/a import org.junit.Ignore;' \
+ -e '/testGetInstance()/i @Ignore' \
+ -i src/test/java/org/easymock/tests2/EasyMockPropertiesTest.java || die
+
+ # 2) testPrimitiveDeprecated(org.easymock.tests2.CaptureTest)
+ # java.lang.AssertionError:
+ # 3) testPrimitiveVsObject(org.easymock.tests2.CaptureTest)
+ # java.lang.AssertionError:
+ sed \
+ -e '/import org.junit.Test/a import org.junit.Ignore;' \
+ -e '/testPrimitiveDeprecated()/i @Ignore' \
+ -e '/testPrimitiveVsObject()/i @Ignore' \
+ -i src/test/java/org/easymock/tests2/CaptureTest.java || die
+}
diff --git a/dev-java/easymock/files/easymock-2.5.5-nameClash.patch b/dev-java/easymock/files/easymock-2.5.5-nameClash.patch
new file mode 100644
index 000000000000..7a4f0d92ab64
--- /dev/null
+++ b/dev-java/easymock/files/easymock-2.5.5-nameClash.patch
@@ -0,0 +1,230 @@
+--- a/src/main/java/org/easymock/EasyMock.java Thu Feb 23 10:32:43 2012 +0100
++++ b/src/main/java/org/easymock/EasyMock.java Thu Feb 23 11:25:46 2012 +0100
+@@ -1452,81 +1452,200 @@
+
+ /**
+ * Expect any object but captures it for later use.
+- *
+- * @param <T> Type of the captured object
+- * @param captured Where the parameter is captured
++ *
++ * @param <T>
++ * Type of the captured object
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>null</code>
+ */
+- public static <T> T capture(Capture<T> captured) {
++ public static <T> T capture(final Capture<T> captured) {
+ reportMatcher(new Captures<T>(captured));
+ return null;
+ }
+-
++
++ /**
++ * Expect any boolean but captures it for later use.
++ *
++ * @param captured
++ * Where the parameter is captured
++ * @return <code>false</code>
++ */
++ public static boolean captureBoolean(final Capture<Boolean> captured) {
++ reportMatcher(new Captures<Boolean>(captured));
++ return false;
++ }
++
++// /**
++// * Expect any boolean but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static boolean capture(final Capture<Boolean> captured) {
++// return captureBoolean(captured);
++// }
++
+ /**
+ * Expect any int but captures it for later use.
+- *
+- * @param captured Where the parameter is captured
++ *
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>0</code>
+ */
+- public static int capture(Capture<Integer> captured) {
++ public static int captureInt(final Capture<Integer> captured) {
+ reportMatcher(new Captures<Integer>(captured));
+ return 0;
+ }
+-
++// /**
++// * Expect any int but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static int capture(final Capture<Integer> captured) {
++// return captureInt(captured);
++// }
++
+ /**
+ * Expect any long but captures it for later use.
+- *
+- * @param captured Where the parameter is captured
++ *
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>0</code>
+ */
+- public static long capture(Capture<Long> captured) {
++ public static long captureLong(final Capture<Long> captured) {
+ reportMatcher(new Captures<Long>(captured));
+ return 0;
+ }
+-
++// /**
++// * Expect any long but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static long capture(final Capture<Long> captured) {
++// return captureLong(captured);
++// }
++
+ /**
+ * Expect any float but captures it for later use.
+- *
+- * @param captured Where the parameter is captured
++ *
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>0</code>
+ */
+- public static float capture(Capture<Float> captured) {
++ public static float captureFloat(final Capture<Float> captured) {
+ reportMatcher(new Captures<Float>(captured));
+ return 0;
+ }
+-
++// /**
++// * Expect any float but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static float capture(final Capture<Float> captured) {
++// return captureFloat(captured);
++// }
++
+ /**
+ * Expect any double but captures it for later use.
+- *
+- * @param captured Where the parameter is captured
++ *
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>0</code>
+ */
+- public static double capture(Capture<Double> captured) {
++ public static double captureDouble(final Capture<Double> captured) {
+ reportMatcher(new Captures<Double>(captured));
+ return 0;
+ }
++// /**
++// * Expect any double but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static double capture(final Capture<Double> captured) {
++// return captureDouble(captured);
++// }
+
+ /**
+ * Expect any byte but captures it for later use.
+- *
+- * @param captured Where the parameter is captured
++ *
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>0</code>
+ */
+- public static byte capture(Capture<Byte> captured) {
++ public static byte captureByte(final Capture<Byte> captured) {
+ reportMatcher(new Captures<Byte>(captured));
+ return 0;
+ }
+-
++// /**
++// * Expect any byte but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static byte capture(final Capture<Byte> captured) {
++// return captureByte(captured);
++// }
++
+ /**
+ * Expect any char but captures it for later use.
+- *
+- * @param captured Where the parameter is captured
++ *
++ * @param captured
++ * Where the parameter is captured
+ * @return <code>0</code>
+ */
+- public static char capture(Capture<Character> captured) {
++ public static char captureChar(final Capture<Character> captured) {
+ reportMatcher(new Captures<Character>(captured));
+ return 0;
+ }
++// /**
++// * Expect any char but captures it for later use.
++// *
++// * @param captured
++// * Where the parameter is captured
++// * @return <code>0</code>
++// *
++// * @deprecated Because of harder erasure enforcement, doesn't compile in
++// * Java 7
++// */
++// @Deprecated
++// public static char capture(final Capture<Character> captured) {
++// return captureChar(captured);
++// }
+
+ /**
+ * Switches the given mock objects (more exactly: the controls of the mock
diff --git a/dev-java/easymock/files/easymock-2.5.5-tests2nameClash.patch b/dev-java/easymock/files/easymock-2.5.5-tests2nameClash.patch
new file mode 100644
index 000000000000..23ed754e3854
--- /dev/null
+++ b/dev-java/easymock/files/easymock-2.5.5-tests2nameClash.patch
@@ -0,0 +1,420 @@
+--- a/src/test/java/org/easymock/tests2/CaptureTest.java Thu Feb 23 10:32:43 2012 +0100
++++ b/src/test/java/org/easymock/tests2/CaptureTest.java Thu Feb 23 11:25:46 2012 +0100
+@@ -1,12 +1,12 @@
+-/*
+- * Copyright 2003-2009 OFFIS, Henri Tremblay
+- *
++/**
++ * Copyright 2001-2011 the original author or authors.
++ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+- *
++ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+- *
++ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@@ -27,10 +27,13 @@
+ import org.junit.Before;
+ import org.junit.Test;
+
++/**
++ * @author Henri Tremblay
++ */
+ public class CaptureTest {
+
+ public static class A {
+- public String foo(IMethods methods) {
++ public String foo(final IMethods methods) {
+ return methods.oneArg(2);
+ }
+ }
+@@ -42,16 +45,16 @@
+ @After
+ public void tearDown() throws Exception {
+ }
+-
+- private Capture<Integer> testCaptureType(CaptureType type) {
+- IMethods mock = createMock(IMethods.class);
+- Capture<Integer> captured = new Capture<Integer>(type);
+-
+- expect(mock.oneArg(capture(captured))).andReturn("1");
++
++ private Capture<Integer> testCaptureType(final CaptureType type) {
++ final IMethods mock = createMock(IMethods.class);
++ final Capture<Integer> captured = new Capture<Integer>(type);
++
++ expect(mock.oneArg(captureInt(captured))).andReturn("1");
+ expect(mock.oneArg(anyInt())).andReturn("1");
+- expect(mock.oneArg(capture(captured))).andReturn("2").times(2);
+- mock.twoArgumentMethod(capture(captured), eq(5));
+- mock.twoArgumentMethod(capture(captured), capture(captured));
++ expect(mock.oneArg(captureInt(captured))).andReturn("2").times(2);
++ mock.twoArgumentMethod(captureInt(captured), eq(5));
++ mock.twoArgumentMethod(captureInt(captured), captureInt(captured));
+
+ replay(mock);
+
+@@ -66,28 +69,28 @@
+
+ return captured;
+ }
+-
++
+ @Test
+ public void testCaptureFirst() {
+- Capture<Integer> captured = testCaptureType(CaptureType.FIRST);
++ final Capture<Integer> captured = testCaptureType(CaptureType.FIRST);
+ assertEquals(0, (int) captured.getValue());
+ }
+
+ @Test
+ public void testCaptureLast() {
+- Capture<Integer> captured = testCaptureType(CaptureType.LAST);
++ final Capture<Integer> captured = testCaptureType(CaptureType.LAST);
+ assertEquals(7, (int) captured.getValue());
+ }
+
+ @Test
+ public void testCaptureAll() {
+- Capture<Integer> captured = testCaptureType(CaptureType.ALL);
++ final Capture<Integer> captured = testCaptureType(CaptureType.ALL);
+ assertEquals(Arrays.asList(0, 2, 3, 4, 6, 7), captured.getValues());
+ }
+
+ @Test
+ public void testCaptureNone() {
+- Capture<Integer> captured = testCaptureType(CaptureType.NONE);
++ final Capture<Integer> captured = testCaptureType(CaptureType.NONE);
+ assertFalse(captured.hasCaptured());
+ }
+
+@@ -96,11 +99,10 @@
+
+ @Test
+ public void testCaptureRightOne() {
+- Capture<String> captured = new Capture<String>();
+- IMethods mock = createMock(IMethods.class);
++ final Capture<String> captured = new Capture<String>();
++ final IMethods mock = createMock(IMethods.class);
+
+- expect(mock.oneArg(and(eq("test"), capture(captured)))).andReturn(
+- "answer1");
++ expect(mock.oneArg(and(eq("test"), capture(captured)))).andReturn("answer1");
+ expect(mock.oneArg("a")).andReturn("answer2");
+
+ replay(mock);
+@@ -114,10 +116,11 @@
+ verify(mock);
+ }
+
++ @SuppressWarnings("deprecation")
+ @Test
+ public void testPrimitiveVsObject() {
+- Capture<Integer> capture = new Capture<Integer>();
+- IMethods mock = createMock(IMethods.class);
++ final Capture<Integer> capture = new Capture<Integer>();
++ final IMethods mock = createMock(IMethods.class);
+
+ expect(mock.oneArg(capture(capture))).andReturn("answer");
+ expect(mock.oneArg((Integer) capture(capture))).andReturn("answer");
+@@ -135,11 +138,10 @@
+
+ @Test
+ public void testAnd() {
+- Capture<String> captured = new Capture<String>();
+- IMethods mock = createMock(IMethods.class);
++ final Capture<String> captured = new Capture<String>();
++ final IMethods mock = createMock(IMethods.class);
+
+- expect(mock.oneArg(and(capture(captured), eq("test")))).andReturn(
+- "answer");
++ expect(mock.oneArg(and(capture(captured), eq("test")))).andReturn("answer");
+
+ replay(mock);
+
+@@ -148,17 +150,19 @@
+
+ verify(mock);
+ }
+-
++
++ @SuppressWarnings("deprecation")
+ @Test
+- public void testPrimitive() {
+- Capture<Integer> captureI = new Capture<Integer>();
+- Capture<Long> captureL = new Capture<Long>();
+- Capture<Float> captureF = new Capture<Float>();
+- Capture<Double> captureD = new Capture<Double>();
+- Capture<Byte> captureB = new Capture<Byte>();
+- Capture<Character> captureC = new Capture<Character>();
++ public void testPrimitiveDeprecated() {
++ final Capture<Integer> captureI = new Capture<Integer>();
++ final Capture<Long> captureL = new Capture<Long>();
++ final Capture<Float> captureF = new Capture<Float>();
++ final Capture<Double> captureD = new Capture<Double>();
++ final Capture<Byte> captureB = new Capture<Byte>();
++ final Capture<Character> captureC = new Capture<Character>();
++ final Capture<Boolean> captureBool = new Capture<Boolean>();
+
+- IMethods mock = createMock(IMethods.class);
++ final IMethods mock = createMock(IMethods.class);
+
+ expect(mock.oneArg(capture(captureI))).andReturn("answerI");
+ expect(mock.oneArg(capture(captureL))).andReturn("answerL");
+@@ -166,6 +170,7 @@
+ expect(mock.oneArg(capture(captureD))).andReturn("answerD");
+ expect(mock.oneArg(capture(captureB))).andReturn("answerB");
+ expect(mock.oneArg(capture(captureC))).andReturn("answerC");
++ expect(mock.oneArg(capture(captureBool))).andReturn("answerZ");
+
+ replay(mock);
+
+@@ -175,6 +180,7 @@
+ assertEquals("answerD", mock.oneArg(4.0));
+ assertEquals("answerB", mock.oneArg((byte) 5));
+ assertEquals("answerC", mock.oneArg((char) 6));
++ assertEquals("answerZ", mock.oneArg(true));
+
+ assertEquals(1, captureI.getValue().intValue());
+ assertEquals(2l, captureL.getValue().longValue());
+@@ -182,19 +188,60 @@
+ assertEquals(4.0, captureD.getValue().doubleValue(), 0.0);
+ assertEquals((byte) 5, captureB.getValue().byteValue());
+ assertEquals((char) 6, captureC.getValue().charValue());
+-
++ assertEquals(true, captureBool.getValue().booleanValue());
++
+ verify(mock);
+ }
+-
++
++ @Test
++ public void testPrimitive() {
++ final Capture<Integer> captureI = new Capture<Integer>();
++ final Capture<Long> captureL = new Capture<Long>();
++ final Capture<Float> captureF = new Capture<Float>();
++ final Capture<Double> captureD = new Capture<Double>();
++ final Capture<Byte> captureB = new Capture<Byte>();
++ final Capture<Character> captureC = new Capture<Character>();
++ final Capture<Boolean> captureBool = new Capture<Boolean>();
++
++ final IMethods mock = createMock(IMethods.class);
++
++ expect(mock.oneArg(captureInt(captureI))).andReturn("answerI");
++ expect(mock.oneArg(captureLong(captureL))).andReturn("answerL");
++ expect(mock.oneArg(captureFloat(captureF))).andReturn("answerF");
++ expect(mock.oneArg(captureDouble(captureD))).andReturn("answerD");
++ expect(mock.oneArg(captureByte(captureB))).andReturn("answerB");
++ expect(mock.oneArg(captureChar(captureC))).andReturn("answerC");
++ expect(mock.oneArg(captureBoolean(captureBool))).andReturn("answerZ");
++
++ replay(mock);
++
++ assertEquals("answerI", mock.oneArg(1));
++ assertEquals("answerL", mock.oneArg(2l));
++ assertEquals("answerF", mock.oneArg(3.0f));
++ assertEquals("answerD", mock.oneArg(4.0));
++ assertEquals("answerB", mock.oneArg((byte) 5));
++ assertEquals("answerC", mock.oneArg((char) 6));
++ assertEquals("answerZ", mock.oneArg(true));
++
++ assertEquals(1, captureI.getValue().intValue());
++ assertEquals(2l, captureL.getValue().longValue());
++ assertEquals(3.0f, captureF.getValue().floatValue(), 0.0);
++ assertEquals(4.0, captureD.getValue().doubleValue(), 0.0);
++ assertEquals((byte) 5, captureB.getValue().byteValue());
++ assertEquals((char) 6, captureC.getValue().charValue());
++ assertEquals(true, captureBool.getValue().booleanValue());
++
++ verify(mock);
++ }
++
+ @Test
+ public void testCapture() {
+- Capture<String> capture = new Capture<String>();
++ final Capture<String> capture = new Capture<String>();
+ assertFalse(capture.hasCaptured());
+ try {
+ capture.getValue();
+ fail("Should not be allowed");
+- }
+- catch(AssertionError e) {
++ } catch (final AssertionError e) {
+ assertEquals("Nothing captured yet", e.getMessage());
+ }
+ assertEquals("Nothing captured yet", capture.toString());
+@@ -207,29 +254,26 @@
+ try {
+ capture.getValue();
+ fail();
+- }
+- catch(AssertionError e) {
++ } catch (final AssertionError e) {
+ assertEquals("Nothing captured yet", e.getMessage());
+ }
+-
++
+ capture.setValue(null);
+ assertTrue(capture.hasCaptured());
+ assertNull(capture.getValue());
+ assertEquals("null", capture.toString());
+ }
+-
++
+ @Test
+ public void testCaptureMultiple() {
+- Capture<String> capture = new Capture<String>(CaptureType.ALL);
++ final Capture<String> capture = new Capture<String>(CaptureType.ALL);
+ capture.setValue("a");
+ capture.setValue("b");
+ try {
+ capture.getValue();
+ fail();
+- } catch (AssertionError e) {
+- assertEquals(
+- "More than one value captured: " + capture.getValues(), e
+- .getMessage());
++ } catch (final AssertionError e) {
++ assertEquals("More than one value captured: " + capture.getValues(), e.getMessage());
+ }
+ assertEquals(Arrays.asList("a", "b"), capture.getValues());
+ }
+@@ -237,30 +281,26 @@
+ @Test
+ public void testCapture_2617107() {
+
+- IMethods mock = createMock(IMethods.class);
++ final IMethods mock = createMock(IMethods.class);
+
+- Capture<String> cap1 = new Capture<String>();
+- Capture<String> cap2 = new Capture<String>();
+- Capture<String> cap3 = new Capture<String>();
+- Capture<String> cap4 = new Capture<String>();
++ final Capture<String> cap1 = new Capture<String>();
++ final Capture<String> cap2 = new Capture<String>();
++ final Capture<String> cap3 = new Capture<String>();
++ final Capture<String> cap4 = new Capture<String>();
+
+- mock.simpleMethodWithArgument(and(isA(String.class),
+- capture(cap1)));
+- mock.simpleMethodWithArgument(and(isA(String.class),
+- capture(cap2)));
+- mock.simpleMethodWithArgument(and(isA(String.class),
+- capture(cap3)));
+- mock.simpleMethodWithArgument(and(isA(String.class),
+- capture(cap4)));
++ mock.simpleMethodWithArgument(and(isA(String.class), capture(cap1)));
++ mock.simpleMethodWithArgument(and(isA(String.class), capture(cap2)));
++ mock.simpleMethodWithArgument(and(isA(String.class), capture(cap3)));
++ mock.simpleMethodWithArgument(and(isA(String.class), capture(cap4)));
+
+ replay(mock);
+
+ final String[] s = { "one", "two", "three", "four" };
+
+- for (int i = 0; i < s.length; i++) {
+- mock.simpleMethodWithArgument(s[i]);
++ for (final String element : s) {
++ mock.simpleMethodWithArgument(element);
+ }
+-
++
+ assertEquals("one", cap1.getValue());
+ assertEquals("two", cap2.getValue());
+ assertEquals("three", cap3.getValue());
+@@ -268,7 +308,7 @@
+
+ verify(mock);
+ }
+-
++
+ @Test
+ public void testCaptureNonStrictControl_2133741() {
+ testCaptureHelper(createMock(IMethods.class));
+@@ -279,9 +319,9 @@
+ testCaptureHelper(createStrictMock(IMethods.class));
+ }
+
+- protected void testCaptureHelper(IMethods mock) {
+- Capture<String> capture1 = new Capture<String>();
+- Capture<String> capture2 = new Capture<String>();
++ protected void testCaptureHelper(final IMethods mock) {
++ final Capture<String> capture1 = new Capture<String>();
++ final Capture<String> capture2 = new Capture<String>();
+
+ mock.simpleMethodWithArgument(capture(capture1));
+ mock.simpleMethodWithArgument(capture(capture2));
+@@ -294,25 +334,25 @@
+ assertTrue(capture1.hasCaptured());
+ assertTrue(capture2.hasCaptured());
+ assertFalse(capture1.getValue() == capture2.getValue());
+- }
+-
++ }
++
+ @Test
+ public void testCapture1_2446744() {
+- Capture<String> capture1 = new Capture<String>();
+- Capture<String> capture2 = new Capture<String>();
+- Capture<String> capture3 = new Capture<String>();
+- IMethods mock = createMock(IMethods.class);
++ final Capture<String> capture1 = new Capture<String>();
++ final Capture<String> capture2 = new Capture<String>();
++ final Capture<String> capture3 = new Capture<String>();
++ final IMethods mock = createMock(IMethods.class);
+ expect(mock.oneArg(capture(capture1))).andReturn("1").once();
+ expect(mock.oneArg(capture(capture2))).andReturn("2").once();
+ expect(mock.oneArg(capture(capture3))).andReturn("3").once();
+-
++
+ replay(mock);
+-
++
+ for (int i = 0; i < 3; i++) {
+- String string = "Run" + (i + 1);
++ final String string = "Run" + (i + 1);
+ mock.oneArg(string);
+ }
+-
++
+ assertEquals("Run3", capture3.getValue());
+ assertEquals("Run2", capture2.getValue());
+ assertEquals("Run1", capture1.getValue());
+@@ -320,16 +360,16 @@
+
+ @Test
+ public void testCapture2_2446744() {
+- Capture<String> capture = new Capture<String>(CaptureType.ALL);
+- IMethods mock = createMock(IMethods.class);
++ final Capture<String> capture = new Capture<String>(CaptureType.ALL);
++ final IMethods mock = createMock(IMethods.class);
+ expect(mock.oneArg(capture(capture))).andReturn("1").once();
+ expect(mock.oneArg(capture(capture))).andReturn("2").once();
+ expect(mock.oneArg(capture(capture))).andReturn("3").once();
+-
++
+ replay(mock);
+-
++
+ for (int i = 0; i < 3; i++) {
+- String string = "Run" + (i + 1);
++ final String string = "Run" + (i + 1);
+ mock.oneArg(string);
+ }
+
+@@ -338,8 +378,8 @@
+
+ @Test
+ public void testCaptureFromStub() {
+- Capture<String> capture = new Capture<String>(CaptureType.ALL);
+- IMethods mock = createMock(IMethods.class);
++ final Capture<String> capture = new Capture<String>(CaptureType.ALL);
++ final IMethods mock = createMock(IMethods.class);
+ expect(mock.oneArg(capture(capture))).andStubReturn("1");
+
+ replay(mock);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-04 9:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04 9:40 [gentoo-commits] repo/gentoo:master commit in: dev-java/easymock/, dev-java/easymock/files/ Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox