mdedetrich commented on code in PR #12781: URL: https://github.com/apache/kafka/pull/12781#discussion_r1006531902
########## connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java: ########## @@ -135,8 +161,7 @@ public class KafkaBasedLogTest { @SuppressWarnings("unchecked") @Before public void setUp() { - store = PowerMock.createPartialMock(KafkaBasedLog.class, new String[]{"createConsumer", "createProducer"}, - TOPIC, PRODUCER_PROPS, CONSUMER_PROPS, consumedCallback, time, initializer); + store = new MockedKafkaBasedLog(TOPIC, PRODUCER_PROPS, CONSUMER_PROPS, () -> null, consumedCallback, time, null); Review Comment: > I think the @Mock private Runnable initializer is the incorrect signature here, and should be changed to be a Consumer mock. Otherwise the initializer value isn't behaving like a mock for the mocked kafka based log. So it appears that the `@Mock private Runnable initializer` is being used correctly in the `setupWithAdmin` method and if you look at `setupWithAdmin` you can confirm its correct because we aren't using a mock, instead we actually using the raw constructor, i.e. ```java private void setupWithAdmin() { Supplier<TopicAdmin> adminSupplier = () -> admin; java.util.function.Consumer<TopicAdmin> initializer = admin -> { }; store = new MockedKafkaBasedLog(TOPIC, PRODUCER_PROPS, CONSUMER_PROPS, adminSupplier, consumedCallback, time, initializer); } ``` I believe the oversight was just in the `setUp` of the mock. -- 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