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 2021/06/18 20:51:49 UTC

[GitHub] [kafka] tang7526 opened a new pull request #10904: MINOR: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest

tang7526 opened a new pull request #10904:
URL: https://github.com/apache/kafka/pull/10904


   Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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.

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



[GitHub] [kafka] ijuma commented on pull request #10904: MINOR: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest

Posted by GitBox <gi...@apache.org>.
ijuma commented on pull request #10904:
URL: https://github.com/apache/kafka/pull/10904#issuecomment-869296229


   Thanks for the PR. We should update build.gradle to remove this test from the JDK 16 exclusion list.


-- 
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



[GitHub] [kafka] ijuma commented on a change in pull request #10904: KAFKA-13060: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest

Posted by GitBox <gi...@apache.org>.
ijuma commented on a change in pull request #10904:
URL: https://github.com/apache/kafka/pull/10904#discussion_r702976716



##########
File path: connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/WorkerGroupMemberTest.java
##########
@@ -86,18 +83,12 @@ public void testMetrics() throws Exception {
                 assertEquals("group-1", mockMetricsReporter.getMetricsContext().contextLabels().get(WorkerConfig.CONNECT_GROUP_ID));
             }
         }
-        assertTrue("Failed to verify MetricsReporter", entered);
+        assertTrue(entered, "Failed to verify M2929etricsReporter");

Review comment:
       I think this was not intended.




-- 
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



[GitHub] [kafka] tang7526 commented on pull request #10904: MINOR: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest

Posted by GitBox <gi...@apache.org>.
tang7526 commented on pull request #10904:
URL: https://github.com/apache/kafka/pull/10904#issuecomment-869481062


   > Thanks for the PR. We should update build.gradle to remove this test from the JDK 16 exclusion list.
   
   Done. I have already removed this test from the JDK 16 exclusion list.


-- 
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



[GitHub] [kafka] tang7526 commented on pull request #10904: MINOR: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest

Posted by GitBox <gi...@apache.org>.
tang7526 commented on pull request #10904:
URL: https://github.com/apache/kafka/pull/10904#issuecomment-863856678


   @chia7712 Could you help to review this PR?  thanks.


-- 
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.

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



[GitHub] [kafka] ijuma commented on a change in pull request #10904: KAFKA-13060: Replace EasyMock and PowerMock with Mockito in WorkerGroupMemberTest

Posted by GitBox <gi...@apache.org>.
ijuma commented on a change in pull request #10904:
URL: https://github.com/apache/kafka/pull/10904#discussion_r702976716



##########
File path: connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/WorkerGroupMemberTest.java
##########
@@ -86,18 +83,12 @@ public void testMetrics() throws Exception {
                 assertEquals("group-1", mockMetricsReporter.getMetricsContext().contextLabels().get(WorkerConfig.CONNECT_GROUP_ID));
             }
         }
-        assertTrue("Failed to verify MetricsReporter", entered);
+        assertTrue(entered, "Failed to verify M2929etricsReporter");

Review comment:
       I think this was not intended.

##########
File path: connect/runtime/src/test/java/org/apache/kafka/connect/runtime/distributed/WorkerGroupMemberTest.java
##########
@@ -27,28 +27,25 @@
 import org.apache.kafka.connect.storage.ConfigBackingStore;
 import org.apache.kafka.connect.storage.StatusBackingStore;
 import org.apache.kafka.connect.util.ConnectUtils;
-import org.easymock.EasyMock;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.easymock.PowerMock;
-import org.powermock.api.easymock.annotation.Mock;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.MockedStatic;
+import org.mockito.junit.jupiter.MockitoExtension;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 import java.lang.management.ManagementFactory;
 import java.util.HashMap;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mockStatic;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ConnectUtils.class})
-@PowerMockIgnore({"javax.management.*", "javax.crypto.*"})
+@ExtendWith(MockitoExtension.class)

Review comment:
       Have we verified that this JUnit 5 feature works correctly even though we're using the junit vintage engine in this module still?




-- 
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