mdedetrich commented on code in PR #12781: URL: https://github.com/apache/kafka/pull/12781#discussion_r1006616025
########## connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java: ########## @@ -547,32 +538,18 @@ public void testReadEndOffsetsUsingAdminThatFailsWithRetriable() throws Exceptio private void setupWithAdmin() { Supplier<TopicAdmin> adminSupplier = () -> admin; java.util.function.Consumer<TopicAdmin> initializer = admin -> { }; - store = PowerMock.createPartialMock(KafkaBasedLog.class, new String[]{"createConsumer", "createProducer"}, - TOPIC, PRODUCER_PROPS, CONSUMER_PROPS, adminSupplier, consumedCallback, time, initializer); + store = new MockedKafkaBasedLog(TOPIC, PRODUCER_PROPS, CONSUMER_PROPS, adminSupplier, consumedCallback, time, initializer); } - private void expectProducerAndConsumerCreate() throws Exception { - PowerMock.expectPrivate(store, "createProducer") - .andReturn(producer); - PowerMock.expectPrivate(store, "createConsumer") - .andReturn(consumer); - } - - private void expectStart() throws Exception { + private void expectStart() { initializer.run(); - EasyMock.expectLastCall().times(1); - - expectProducerAndConsumerCreate(); + verify(initializer, times(1)).run(); } private void expectStop() { producer.close(); - PowerMock.expectLastCall(); + verify(producer, times(1)).close(); Review Comment: Okay so you can largely ignore my previous comment, I missed the `replayAll` which was being called elsewhere which means we are actually expecting `producer.close()` to be called indirectly. I did this quickly and realized that I also need to change the `initial` argument for the mock constructor in `setUp` (see https://github.com/apache/kafka/pull/12781#discussion_r1006531902) -- 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