@Test
public void testAccurateMatch() {

    Set<String> names = new HashSet<String>();
    names.add("middleware.product.provider.qps");
    names.add("shared.carts.my_cart.m1");
    names.add("shared.carts.my_cart1.stddev");
    names.add("shared.carts.my_cart2.error.count");
    MetricNameSetFilter filter = new MetricNameSetFilter(names);
    MetricName mn = MetricName.build("shared.carts.my_cart");
    MetricName mn1 = MetricName.build("shared.carts.my_cart1");
    MetricName mn2 = MetricName.build("shared.carts.my_cart2");
    Meter meter = MetricManager.getMeter("carts", mn);
    Histogram histogram = MetricManager.getHistogram("carts", mn1);
    Compass compass = MetricManager.getCompass("carts", mn2);
    Assert.assertTrue(filter.matches(mn, meter));
    Assert.assertTrue(filter.matches(mn1, histogram));
    Assert.assertTrue(filter.matches(mn2, compass));
}