@Test
    public void testMaxRetriesReached() throws Exception {
        HiveMetaStoreClient spyMSC = spy(msc);
        hive.setMSC(spyMSC);
        doThrow(MetaException.class).when(spyMSC).listPartitionsWithAuthInfoRequest(any());
        int maxRetries = 2;
        try {
            hive.getAllPartitionsInBatches(hive.getTable(dbName, tableName), NUM_PARTITIONS, DECAYING_FACTOR, maxRetries,
                    PARTIAL_PARTITION_SPEC, IS_AUTH_REQUIRED, USER_NAME, GROUP_NAMES);
        } catch (HiveException ignored) {}
        ArgumentCaptor<GetPartitionsPsWithAuthRequest> req = ArgumentCaptor.forClass(GetPartitionsPsWithAuthRequest.class);
        // there should be 2 call to get partitions with batch sizes as 30, 15
        verify(spyMSC, times(2)).listPartitionsWithAuthInfoRequest(req.capture());
        List<GetPartitionsPsWithAuthRequest> apds = req.getAllValues();
        Assert.assertEquals(2, apds.size());

        Assert.assertEquals(30, apds.get(0).getPartNamesSize());
        Assert.assertEquals(15, apds.get(1).getPartNamesSize());
    }
Tests the maximum retry attempts provided by configuration
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/exec/TestGetPartitionAuthWithBatches.java