mdedetrich commented on code in PR #12781: URL: https://github.com/apache/kafka/pull/12781#discussion_r1003753991
########## connect/runtime/src/test/java/org/apache/kafka/connect/util/KafkaBasedLogTest.java: ########## @@ -547,32 +540,22 @@ 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); + final Field storeThreadField = FieldUtils.getField(MockedKafkaBasedLog.class, "thread", true); + private Thread getStorePrivateThread() throws IllegalAccessException { + return (Thread) storeThreadField.get(store); } - 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(); + doNothing().when(producer).close(); // MockConsumer close is checked after test. } - private static ByteBuffer buffer(String v) { Review Comment: This isn't actually used. -- 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