@Test
public void testGetCategories() {

  String propertyId = "metrics/yarn/Queue/$1.replaceAll(\",q(\\d+)=\",\"/\").substring(1)/AppsRunning";
  Set<String> categories = PropertyHelper.getCategories(Collections.singleton(propertyId));
  Assert.assertTrue(categories.contains("metrics/yarn/Queue/$1"));
  Assert.assertTrue(categories.contains("metrics/yarn/Queue"));
  Assert.assertTrue(categories.contains("metrics/yarn"));
  Assert.assertTrue(categories.contains("metrics"));
  String propertyId2 = "foo/bar/baz";
  Set<String> propertyIds = new HashSet<String>();
  propertyIds.add(propertyId);
  propertyIds.add(propertyId2);
  categories = PropertyHelper.getCategories(propertyIds);
  Assert.assertTrue(categories.contains("metrics/yarn/Queue/$1"));
  Assert.assertTrue(categories.contains("metrics/yarn/Queue"));
  Assert.assertTrue(categories.contains("metrics/yarn"));
  Assert.assertTrue(categories.contains("metrics"));
  Assert.assertTrue(categories.contains("foo/bar"));
  Assert.assertTrue(categories.contains("foo"));
}