@Test
  public void testGetPartitionsByNames() throws Exception {
    Table t = createTable4PartColsParts(getClient()).table;
    List<String> part_names = Arrays.asList("yyyy=1999/mm=01/dd=02",
        "yyyy=2009/mm=02/dd=10", "yyyy=1999/mm=03/dd=02");
    GetPartitionsByNamesRequest request = convertToGetPartitionsByNamesRequest(
        MetaStoreUtils.prependCatalogToDbName(t.getCatName(), t.getDbName(), hiveConf), t.getTableName(),
        part_names);
    List<Partition> partitions = getClient().getPartitionsByNames(request).getPartitions();
    List<List<String>> values = partitions.stream().map(partition -> partition.getValues()).collect(Collectors.toList());
    assertCorrectPartitionNames(part_names.subList(0, 2), values, Lists.newArrayList("yyyy", "mm", "dd"));
    assertPartitionsHaveCorrectParams(partitions);

    // empty
    part_names = Arrays.asList("yyyy=1999/mm=03/dd=02", "yyyy=2017/mm=02/dd=13");
    request = convertToGetPartitionsByNamesRequest(
        MetaStoreUtils.prependCatalogToDbName(t.getCatName(), t.getDbName(), hiveConf), t.getTableName(),
        part_names);
    partitions = getClient().getPartitionsByNames(request).getPartitions();
    assertTrue(partitions.isEmpty());
  }
Test class for list partitions with configurable include/exclude pattern on parameters.
Embedded Metastore uses JDO, Remote Metastore uses direct SQL to query the partitions:
MetaStoreFactoryForTests.getMetaStores()
ql/src/test/org/apache/hadoop/hive/metastore/TestListPartitionsWithXIncludeParams.java