private void assert_invariant() throws HCatException {

    if (hcatTable != null) {

      if (!hcatTable.getDbName().equalsIgnoreCase(partitionSpecProxy.getDbName())) {
        String errorMessage = "Invalid HCatPartitionSpec instance: Table's DBName (" + hcatTable.getDbName() + ") " +
            "doesn't match PartitionSpec (" + partitionSpecProxy.getDbName() + ")";
        assert false : errorMessage;
        throw new HCatException(errorMessage);
      }

      if (!hcatTable.getTableName().equalsIgnoreCase(partitionSpecProxy.getTableName())) {
        String errorMessage = "Invalid HCatPartitionSpec instance: Table's TableName (" + hcatTable.getTableName() + ") " +
            "doesn't match PartitionSpec (" + partitionSpecProxy.getTableName() + ")";
        assert false : errorMessage;
        throw new HCatException(errorMessage);
      }
    }
  }
Getter for an Iterator to the first HCatPartition in the HCatPartitionSpec.
@return HCatPartitionIterator to the first HCatPartition.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartitionSpec.java