@Test
  public void fewPresentWithMultipleConstraints() throws TException {
    Table table = testTables[0];
    SQLAllTableConstraints expected = new SQLAllTableConstraints();
    // Set col1 as primary key Constraint in default catalog and database
    List<SQLPrimaryKey> pk = new SQLPrimaryKeyBuilder().onTable(table).addColumn("col1").setConstraintName("col1_pk")
        .build(metaStore.getConf());
    client.addPrimaryKey(pk);
    expected.setPrimaryKeys(pk);

    // Set col2 with Unique Constraint in default catalog and database
    List<SQLUniqueConstraint> uc =
        new SQLUniqueConstraintBuilder().onTable(table).addColumn("col2").setConstraintName("col2_unique")
            .build(metaStore.getConf());
    client.addUniqueConstraint(uc);
    expected.setUniqueConstraints(uc);

    // Set col3 with default Constraint in default catalog and database
    List<SQLDefaultConstraint> dv =
        new SQLDefaultConstraintBuilder().onTable(table).addColumn("col3").setConstraintName("col3_default")
            .setDefaultVal(false).build(metaStore.getConf());
    client.addDefaultConstraint(dv);
    expected.setDefaultConstraints(dv);

    // Set col2 with not null constraint in default catalog and database;
    SQLNotNullConstraint nnCol2 =
        new SQLNotNullConstraint(table.getCatName(), table.getDbName(), table.getTableName(), "col2", "col2_not_null",
            true, true, true);
    SQLNotNullConstraint nnCol3 =
        new SQLNotNullConstraint(table.getCatName(), table.getDbName(), table.getTableName(), "col3", "col3_not_null",
            true, true, true);
    List<SQLNotNullConstraint> nn = new ArrayList<>();
    nn.add(nnCol2);
    nn.add(nnCol3);
    client.addNotNullConstraint(nn);
    expected.setNotNullConstraints(nn);

    expected.setForeignKeys(new ArrayList<>());
    expected.setCheckConstraints(new ArrayList<>());
    // Fetch all constraints for the table in default catalog and database
    AllTableConstraintsRequest request =
        new AllTableConstraintsRequest(table.getDbName(), table.getTableName(), table.getCatName());
    SQLAllTableConstraints fetched = client.getAllTableConstraints(request);
    Assert.assertEquals(expected, fetched);

  }
Test where only some of the constraints are present along with multiple values for a single constraint
@throws TException
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestGetAllTableConstraints.java