protected List<ShowCompactResponseElement> verifyCompaction(int expectedNumberOfCompactions, String expectedState) throws MetaException {
    List<ShowCompactResponseElement> compacts =
        TxnUtils.getTxnStore(conf).showCompact(new ShowCompactRequest()).getCompacts();
    Assert.assertEquals("Compaction queue must contain " + expectedNumberOfCompactions + " element(s)",
        expectedNumberOfCompactions, compacts.size());
    compacts.forEach(
        c -> Assert.assertEquals("Compaction state is not " + expectedState, expectedState, c.getState()));
    return compacts;
  }
Verify that the expected number of compactions have run, and their state matches the given state.

@param expectedNumberOfCompactions number of compactions already run
@param expectedState The expected state of all the compactions
@throws MetaException
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorOnTezTest.java