Divij Vaidya created KAFKA-14969: ------------------------------------ Summary: Upgrade Mockito to 4.11.0 Key: KAFKA-14969 URL: https://issues.apache.org/jira/browse/KAFKA-14969 Project: Kafka Issue Type: Improvement Components: unit tests Reporter: Divij Vaidya Fix For: 3.6.0
Upgrading to Mockito 4.11.0 leads to following errors. Need to fix them before upgrade. Note that we cannot upgrade to Mockito 5 because it doesn't support JDK 8. {code:java} [2023-05-05T12:21:58.628Z] > Task :core:compileTestScala [2023-05-05T12:21:58.628Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala:2654:31: ambiguous reference to overloaded definition, [2023-05-05T12:21:58.628Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:21:58.628Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:21:58.628Z] match argument types (kafka.server.metadata.MockConfigRepository) [2023-05-05T12:21:58.628Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala:2658:25: ambiguous reference to overloaded definition, [2023-05-05T12:21:58.628Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:21:58.628Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:21:58.628Z] match argument types (kafka.log.LogManager) [2023-05-05T12:21:58.628Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala:2688:31: ambiguous reference to overloaded definition, [2023-05-05T12:21:58.628Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:21:58.628Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:21:58.628Z] match argument types (kafka.server.metadata.MockConfigRepository) [2023-05-05T12:21:58.628Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala:2692:25: ambiguous reference to overloaded definition, [2023-05-05T12:21:58.628Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:21:58.628Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:21:58.628Z] match argument types (kafka.log.LogManager) [2023-05-05T12:21:58.628Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala:2728:31: ambiguous reference to overloaded definition, [2023-05-05T12:21:58.628Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:21:58.628Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:21:58.628Z] match argument types (kafka.server.metadata.MockConfigRepository) [2023-05-05T12:21:58.628Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/cluster/PartitionTest.scala:2734:25: ambiguous reference to overloaded definition, [2023-05-05T12:21:58.628Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:21:58.628Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:21:58.628Z] match argument types (kafka.log.LogManager) [2023-05-05T12:22:06.267Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala:807:21: ambiguous reference to overloaded definition, [2023-05-05T12:22:06.267Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:06.267Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:06.267Z] match argument types (controller.eventManager.ControllerEventThread) [2023-05-05T12:22:06.267Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/controller/ControllerIntegrationTest.scala:838:21: ambiguous reference to overloaded definition, [2023-05-05T12:22:06.267Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:06.267Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:06.267Z] match argument types (controller.eventManager.ControllerEventThread){code} {code:java} [2023-05-05T12:22:40.865Z] > Task :core:compileTestScala [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:171:18: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.log.LogManager) and expected result type kafka.log.LogManager [2023-05-05T12:22:40.865Z] Error occurred in an application involving default arguments. [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:530:31: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.server.metadata.MockConfigRepository) [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:532:25: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.log.LogManager) [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:566:31: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.server.metadata.MockConfigRepository) [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:568:25: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.log.LogManager) [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:585:31: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.server.metadata.MockConfigRepository) [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:587:25: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.log.LogManager) [2023-05-05T12:22:40.865Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:614:25: ambiguous reference to overloaded definition, [2023-05-05T12:22:40.865Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:40.865Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:40.865Z] match argument types (kafka.log.LogManager) [2023-05-05T12:22:41.716Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:773:25: ambiguous reference to overloaded definition, [2023-05-05T12:22:41.716Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:41.716Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:41.716Z] match argument types (kafka.log.LogManager) [2023-05-05T12:22:41.716Z] [Error] /home/jenkins/jenkins-agent/712657a4/workspace/Kafka_kafka-pr_PR-13673/core/src/test/scala/unit/kafka/log/LogManagerTest.scala:844:25: ambiguous reference to overloaded definition, [2023-05-05T12:22:41.716Z] both method spy in class Mockito of type [T](x$1: T*)T [2023-05-05T12:22:41.716Z] and method spy in class Mockito of type [T](x$1: T)T [2023-05-05T12:22:41.716Z] match argument types (kafka.log.LogManager) {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)