mdedetrich commented on code in PR #12725:
URL: https://github.com/apache/kafka/pull/12725#discussion_r1003526116


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/rest/resources/ConnectorsResourceTest.java:
##########
@@ -841,55 +702,45 @@ public void testRestartConnectorAndTasksRequestAccepted() 
throws Throwable {
         ConnectorStateInfo connectorStateInfo = new 
ConnectorStateInfo(CONNECTOR_NAME, state, Collections.emptyList(), 
ConnectorType.SOURCE);
 
         RestartRequest restartRequest = new RestartRequest(CONNECTOR_NAME, 
true, false);
-        final Capture<Callback<ConnectorStateInfo>> cb = Capture.newInstance();
-        herder.restartConnectorAndTasks(EasyMock.eq(restartRequest), 
EasyMock.capture(cb));
-        expectAndCallbackResult(cb, connectorStateInfo);
-
-        PowerMock.replayAll();
+        final ArgumentCaptor<Callback<ConnectorStateInfo>> cb = 
ArgumentCaptor.forClass(Callback.class);
+        expectAndCallbackResult(cb, connectorStateInfo)
+            .when(herder).restartConnectorAndTasks(eq(restartRequest), 
cb.capture());
 
         Response response = 
connectorsResource.restartConnector(CONNECTOR_NAME, NULL_HEADERS, 
restartRequest.includeTasks(), restartRequest.onlyFailed(), FORWARD);
         assertEquals(CONNECTOR_NAME, ((ConnectorStateInfo) 
response.getEntity()).name());
         assertEquals(state.state(), ((ConnectorStateInfo) 
response.getEntity()).connector().state());
         assertEquals(Response.Status.ACCEPTED.getStatusCode(), 
response.getStatus());
-        PowerMock.verifyAll();
     }
 
     @Test
     public void testFenceZombiesNoInternalRequestSignature() throws Throwable {
-        final Capture<Callback<Void>> cb = Capture.newInstance();
-        herder.fenceZombieSourceTasks(EasyMock.eq(CONNECTOR_NAME), 
EasyMock.capture(cb), EasyMock.anyObject(InternalRequestSignature.class));
-        expectAndCallbackResult(cb, null);
-
-        PowerMock.replayAll();
+        final ArgumentCaptor<Callback<Void>> cb = 
ArgumentCaptor.forClass(Callback.class);
+        final ArgumentCaptor<InternalRequestSignature> signatureCapture = 
ArgumentCaptor.forClass(InternalRequestSignature.class);

Review Comment:
   The `argumentCapture` in this case is pointless, in this case we appear to 
be testing that fenceZombies work when `InternalRequestSignature` is null.
   
   I fixed this in the `Remove unneeded ArgumentCapture for 
InternalRequestSignature in testFenceZombiesNoInternalRequestSignature`, 
resolve the thread if you are happy with it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to