InvisibleProgrammer commented on code in PR #4707:
URL: https://github.com/apache/hive/pull/4707#discussion_r1341090697


##########
ql/src/test/org/apache/hadoop/hive/ql/exec/repl/ranger/TestRangerRestClient.java:
##########
@@ -54,23 +55,26 @@ public class TestRangerRestClient {
   @Mock
   private HiveConf conf;
 
+  MockedStatic<UserGroupInformation> userGroupInformationMockedStatic;
+
   @Before
   public void setup() throws Exception {
-    PowerMockito.mockStatic(UserGroupInformation.class);
-    
Mockito.when(UserGroupInformation.getLoginUser()).thenReturn(userGroupInformation);
-    Mockito.when(userGroupInformation.doAs((PrivilegedAction<Object>) 
Mockito.any())).thenCallRealMethod();
-    Mockito.when(userGroupInformation.doAs((PrivilegedExceptionAction<Object>) 
Mockito.any())).thenCallRealMethod();
+    userGroupInformationMockedStatic = mockStatic(UserGroupInformation.class);
+
+    
userGroupInformationMockedStatic.when(UserGroupInformation::getLoginUser).thenReturn(userGroupInformation);
+
     Mockito.when(mockClient.getRangerExportUrl(Mockito.anyString(), 
Mockito.anyString(), Mockito.anyString()))
-      .thenCallRealMethod();
-    Mockito.when(mockClient.getRangerImportUrl(Mockito.anyString(), 
Mockito.anyString()))

Review Comment:
   No. It was a leftover. Mockito is way more restrictive than PowerMock and it 
doesn't allow stubbing. If I put it back into the code, it won't even run the 
tests, it gets something like UnnecessaryStubbingException. 



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to