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/06/13 12:33:19 UTC

[GitHub] [kafka] cadonna commented on a diff in pull request #10881: KAFKA-12947 Replace EasyMock and PowerMock with Mockito for Streams…

cadonna commented on code in PR #10881:
URL: https://github.com/apache/kafka/pull/10881#discussion_r895663246


##########
streams/src/test/java/org/apache/kafka/streams/kstream/internals/graph/TableSourceNodeTest.java:
##########
@@ -23,43 +23,32 @@
 import org.apache.kafka.streams.kstream.internals.MaterializedInternal;
 import org.apache.kafka.streams.kstream.internals.graph.TableSourceNode.TableSourceNodeBuilder;
 import org.apache.kafka.streams.processor.internals.InternalTopologyBuilder;
-import org.easymock.EasyMock;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.easymock.PowerMock;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
 import java.util.Properties;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({InternalTopologyBuilder.class})
+import static org.mockito.Mockito.mock;
+
 public class TableSourceNodeTest {
 
     private static final String STORE_NAME = "store-name";
     private static final String TOPIC = "input-topic";
 
-    private final InternalTopologyBuilder topologyBuilder = PowerMock.createNiceMock(InternalTopologyBuilder.class);
+    private final InternalTopologyBuilder topologyBuilder = mock(InternalTopologyBuilder.class);
 
     @Test
     public void shouldConnectStateStoreToInputTopicIfInputTopicIsUsedAsChangelog() {
         final boolean shouldReuseSourceTopicForChangelog = true;
         topologyBuilder.connectSourceStoreAndTopic(STORE_NAME, TOPIC);
-        EasyMock.replay(topologyBuilder);
 
         buildTableSourceNode(shouldReuseSourceTopicForChangelog);
-
-        EasyMock.verify(topologyBuilder);

Review Comment:
   @wycccccc I do not agree. You have to add `verify(topologyBuilder).connecSourceStoreAndTopic(STORE_NAME, TOPIC);`. How should Mockito know what to verify? 



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