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


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/standalone/StandaloneHerderTest.java:
##########
@@ -602,36 +546,37 @@ public void testRestartConnectorAndTasksOnlyConnector() 
throws Exception {
         FutureCallback<ConnectorStateInfo> restartCallback = new 
FutureCallback<>();
         herder.restartConnectorAndTasks(restartRequest, restartCallback);
         assertEquals(connectorStateInfo, restartCallback.get(1000L, 
TimeUnit.MILLISECONDS));
-        PowerMock.verifyAll();
+
+        verifyConnectorStatusRestart();
     }
 
     @Test
     public void testRestartConnectorAndTasksOnlyTasks() throws Exception {
         ConnectorTaskId taskId = new ConnectorTaskId(CONNECTOR_NAME, 0);
         RestartRequest restartRequest = new RestartRequest(CONNECTOR_NAME, 
false, true);
-        RestartPlan restartPlan = PowerMock.createMock(RestartPlan.class);
-        ConnectorStateInfo connectorStateInfo = 
PowerMock.createMock(ConnectorStateInfo.class);
-        
EasyMock.expect(restartPlan.shouldRestartConnector()).andReturn(false).anyTimes();
-        
EasyMock.expect(restartPlan.shouldRestartTasks()).andReturn(true).anyTimes();
-        
EasyMock.expect(restartPlan.restartTaskCount()).andReturn(1).anyTimes();
-        EasyMock.expect(restartPlan.totalTaskCount()).andReturn(1).anyTimes();
-        
EasyMock.expect(restartPlan.taskIdsToRestart()).andReturn(Collections.singletonList(taskId)).anyTimes();
-        
EasyMock.expect(restartPlan.restartConnectorStateInfo()).andReturn(connectorStateInfo).anyTimes();
-        EasyMock.expect(herder.buildRestartPlan(restartRequest))
-                .andReturn(Optional.of(restartPlan)).anyTimes();
+        RestartPlan restartPlan = mock(RestartPlan.class);
+        ConnectorStateInfo connectorStateInfo = mock(ConnectorStateInfo.class);
+        when(restartPlan.shouldRestartConnector()).thenReturn(false);
+        when(restartPlan.shouldRestartTasks()).thenReturn(true);
+        when(restartPlan.restartTaskCount()).thenReturn(1);
+        when(restartPlan.totalTaskCount()).thenReturn(1);
+        
when(restartPlan.taskIdsToRestart()).thenReturn(Collections.singletonList(taskId));
+        
when(restartPlan.restartConnectorStateInfo()).thenReturn(connectorStateInfo);
+        
doReturn(Optional.of(restartPlan)).when(herder).buildRestartPlan(restartRequest);
 
         herder.onRestart(taskId);
-        EasyMock.expectLastCall();
+        verify(statusBackingStore).put(new TaskStatus(new 
ConnectorTaskId(CONNECTOR_NAME, 0), AbstractStatus.State.RESTARTING, WORKER_ID, 
0));
 
-        connector = PowerMock.createMock(BogusSinkConnector.class);
+        doNothing().when(herder).onRestart(taskId);

Review Comment:
   Last comment was a misnomer, committed and pushed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to