Adapt to EasyMock's deprecation of 'new Capture()' Since EasyMock is changing their suggested API every now and then, we add a method to create Captures to MockingTestCase. Change-Id: Ic86531395fae8fb84df5cbb9748e4421baac103e
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java index adec9da..dbb3d06 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java +++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/testutil/MockingTestCase.java
@@ -16,6 +16,7 @@ import junit.framework.TestCase; +import org.easymock.Capture; import org.easymock.EasyMock; import org.easymock.IMocksControl; import org.junit.After; @@ -150,4 +151,13 @@ // subclasses open. verifyMocks(); } + + /** + * Create a new Capture. + * + * @return The created Capture. + */ + protected final <T> Capture<T> createCapture() { + return EasyMock.newCapture(); + } }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityCommentTest.java b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityCommentTest.java index 834e665..674d199 100644 --- a/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityCommentTest.java +++ b/src/test/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityCommentTest.java
@@ -124,7 +124,7 @@ properties.add(propertySubject); IAnswer<Boolean> answer = new VelocityWriterFiller("Rosebud"); - Capture<VelocityContext> contextCapture = new Capture<>(); + Capture<VelocityContext> contextCapture = createCapture(); expect(velocityRuntime.evaluate(capture(contextCapture), (Writer)anyObject(), (String)anyObject(), eq("${subject}"))) .andAnswer(answer); @@ -186,7 +186,7 @@ properties.add(propertyReason); IAnswer<Boolean> answer = new VelocityWriterFiller("Rosebud Life Rosebud"); - Capture<VelocityContext> contextCapture = new Capture<>(); + Capture<VelocityContext> contextCapture = createCapture(); expect(velocityRuntime.evaluate(capture(contextCapture), (Writer)anyObject(), (String)anyObject(), eq("${subject} ${reason} ${subject}"))).andAnswer(answer); @@ -213,7 +213,7 @@ new String[] {"inline", "Simple-Text"}); IAnswer<Boolean> answer = new VelocityWriterFiller("Simple-Text"); - Capture<VelocityContext> contextCapture = new Capture<>(); + Capture<VelocityContext> contextCapture = createCapture(); expect(velocityRuntime.evaluate(capture(contextCapture), (Writer)anyObject(), (String)anyObject(), eq("Simple-Text"))) .andAnswer(answer); @@ -248,7 +248,7 @@ new String[] {"inline", "Simple-Text"}); IAnswer<Boolean> answer = new VelocityWriterFiller("Simple-Text"); - Capture<VelocityContext> contextCapture = new Capture<>(); + Capture<VelocityContext> contextCapture = createCapture(); expect(velocityRuntime.evaluate(capture(contextCapture), (Writer)anyObject(), (String)anyObject(), eq("Simple-Text"))) .andAnswer(answer); @@ -329,7 +329,7 @@ IAnswer<Boolean> answer = new VelocityWriterFiller( "Test Template with subject: Rosebud.\n" + "Life is the reason for Rosebud."); - Capture<VelocityContext> contextCapture = new Capture<>(); + Capture<VelocityContext> contextCapture = createCapture(); expect(velocityRuntime.evaluate(capture(contextCapture), (Writer)anyObject(), (String)anyObject(), eq("Test Template with subject: ${subject}.\n" +