@Test
  public void testUnevenNumberOfCreatePartitionCalls() throws Exception {
    // create 9 dummy partitions
    Set<PartitionResult> partsNotInMs = PartitionUtil.createPartsNotInMs(9);
    IMetaStoreClient spyDb = spy(db);
    // batch size of 5 and decaying factor of 2
    msck.createPartitionsInBatches(spyDb, repairOutput, partsNotInMs, table, 5, 2, 0);
    // there should be 2 calls to create partitions with batch sizes of 5, 4
    ArgumentCaptor<Boolean> ifNotExistsArg = ArgumentCaptor.forClass(Boolean.class);
    ArgumentCaptor<Boolean> needResultsArg = ArgumentCaptor.forClass(Boolean.class);
    ArgumentCaptor<List<Partition>> argParts = ArgumentCaptor.forClass(List.class);
    verify(spyDb, times(2)).add_partitions(argParts.capture(), ifNotExistsArg.capture(), needResultsArg.capture());
    // confirm the batch sizes were 5, 4 in the two calls to create partitions
    List<List<Partition>> apds = argParts.getAllValues();
    int retryAttempt = 1;
    Assert.assertEquals(String.format("Unexpected batch size in retry attempt %d ", retryAttempt++),
        5, apds.get(0).size());
    Assert.assertEquals(String.format("Unexpected batch size in retry attempt %d ", retryAttempt++),
        4, apds.get(1).size());
    assertTrue(ifNotExistsArg.getValue());
    assertFalse(needResultsArg.getValue());
  }
Tests the number of times Hive.createPartitions calls are executed with total number of
partitions to be added are not exactly divisible by batch size

@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/exec/TestMsckCreatePartitionsInBatches.java