[ 
https://issues.apache.org/jira/browse/KAFKA-17160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867130#comment-17867130
 ] 

Chia-Ping Tsai commented on KAFKA-17160:
----------------------------------------

Thanks Juma feedback.

Yes, the Java version is one of condition of defining mockito version, and it 
works well. 

However, this issue is talking about scala version which can define the mockito 
version too.

For example: running tests by JDK17 + Scala 2.12 will use mockito-core:4.9.0, 
and it results in mock error when mocking final class.



> Always import `mockito-inline` if the mockito version is 4.x
> ------------------------------------------------------------
>
>                 Key: KAFKA-17160
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17160
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Chia-Ping Tsai
>            Assignee: Ming-Yen Chung
>            Priority: Minor
>
> Currently, we pick up mockito artifact according to java version[0]. It can 
> cause mock error on final class when we run JDK 11+ with scala 2.12, since it 
> imports the 4.x mockito-core which does not include features of mockito-line. 
> In short, the artifact should be based on mockito version rather than java 
> version. Otherwise, some tests (for example, `PCollectionsImmutableSetTest`) 
> never pass
> [0] https://github.com/apache/kafka/blob/trunk/gradle/dependencies.gradle#L74



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to