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

ASF GitHub Bot commented on HADOOP-19243:
-----------------------------------------

sadanand48 commented on code in PR #6968:
URL: https://github.com/apache/hadoop/pull/6968#discussion_r1708660889


##########
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCacheDirectives.java:
##########
@@ -1575,7 +1575,7 @@ public void testNoLookupsWhenNotUsed() throws Exception {
     CacheManager cm = cluster.getNamesystem().getCacheManager();
     LocatedBlocks locations = Mockito.mock(LocatedBlocks.class);
     cm.setCachedLocations(locations);
-    Mockito.verifyZeroInteractions(locations);

Review Comment:
   ``` java
     public static void verifyZeroInteractions(Object... mocks)
         throws InvocationTargetException, IllegalAccessException,
         NoSuchMethodException {
       String mockitoVersion = 
Mockito.class.getPackage().getSpecificationVersion();
       Method verifyInteractions;
       if (mockitoVersion.compareTo("4.1.1") < 0){
         verifyInteractions = 
Mockito.class.getMethod("verifyZeroInteractions",mocks.getClass());
       } else {
         verifyInteractions = 
Mockito.class.getMethod("verifyNoInteractions",mocks.getClass());
       }
       verifyInteractions.invoke(null,mocks);
     }
   ```
   Not tried this but something like this could work. But is it okay to use 
reflections ?





> Upgrade Mockito version to 4.11.0
> ---------------------------------
>
>                 Key: HADOOP-19243
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19243
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Muskan Mishra
>            Assignee: Muskan Mishra
>            Priority: Major
>              Labels: pull-request-available
>
> While Compiling test classes with JDK17, faced error related to Mockito:
> *Mockito cannot mock this class.*
> So to make it compatible with jdk17 we have to upgrade the version of 
> mockito-core as well as mockito-inline.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to