@Test
  public void testSuccessSimpleAuthRangerExport() throws Exception {
    Mockito.when(UserGroupInformation.isSecurityEnabled()).thenReturn(false);
    Mockito.when(mockClient.exportRangerPoliciesPlain(Mockito.anyString(),
            Mockito.any(HiveConf.class))).thenReturn(new RangerExportPolicyList());
    Mockito.when(mockClient.exportRangerPolicies(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
      Mockito.any()))
      .thenCallRealMethod();
    mockClient.exportRangerPolicies("http://localhost:6080/ranger", "db",
      "hive", conf);
    ArgumentCaptor<String> urlCaptor = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<String> dbCaptor = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<String> serviceCaptor = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<HiveConf> confCaptor = ArgumentCaptor.forClass(HiveConf.class);
    Mockito.verify(mockClient,
      Mockito.times(1)).exportRangerPolicies(urlCaptor.capture(), dbCaptor.capture(),
      serviceCaptor.capture(), confCaptor.capture());
    Assert.assertEquals("http://localhost:6080/ranger", urlCaptor.getValue());
    Assert.assertEquals("db", dbCaptor.getValue());
    Assert.assertEquals("hive", serviceCaptor.getValue());
    ArgumentCaptor<PrivilegedAction> privilegedActionArgumentCaptor = ArgumentCaptor.forClass(PrivilegedAction.class);
    Mockito.verify(userGroupInformation,
      Mockito.times(0)).doAs(privilegedActionArgumentCaptor.capture());
  }
Unit test class for testing Ranger Dump.
ql/src/test/org/apache/hadoop/hive/ql/exec/repl/ranger/TestRangerRestClient.java