You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2022/08/18 09:21:51 UTC

[GitHub] [kafka] mimaison commented on a diff in pull request #12509: KAFKA-14133: Replace EasyMock with Mockito in WorkerCoordinatorTest and RootResourceTest

mimaison commented on code in PR #12509:
URL: https://github.com/apache/kafka/pull/12509#discussion_r948858351


##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/WorkerCoordinatorTest.java:
##########
@@ -432,30 +422,28 @@ public void testLeaderPerformAssignment1() {
         assertEquals(Collections.emptyList(), memberAssignment.connectors());
         assertEquals(Collections.singletonList(taskId1x0), memberAssignment.tasks());
 
-        PowerMock.verifyAll();
+        verify(configStorage).snapshot();
     }
 
     @Test
     public void testLeaderPerformAssignment2() {
         // Since all the protocol responses are mocked, the other tests validate doSync runs, but don't validate its
         // output. So we test it directly here.
 
-        EasyMock.expect(configStorage.snapshot()).andReturn(configState2);
-
-        PowerMock.replayAll();
+        when(configStorage.snapshot()).thenReturn(configState2);
 
         // Prime the current configuration state
         coordinator.metadata();
 
-        // Mark everyone as in sync with configState1
+        // Mark everyone as in sync with configState2
         List<JoinGroupResponseData.JoinGroupResponseMember> responseMembers = new ArrayList<>();
         responseMembers.add(new JoinGroupResponseData.JoinGroupResponseMember()
                 .setMemberId("leader")
-                .setMetadata(ConnectProtocol.serializeMetadata(new ConnectProtocol.WorkerState(LEADER_URL, 1L)).array())
+                .setMetadata(ConnectProtocol.serializeMetadata(new ConnectProtocol.WorkerState(LEADER_URL, 2L)).array())

Review Comment:
   Should we use `configState2.offset()` instead of the literal? WDYT



-- 
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-unsubscribe@kafka.apache.org

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