MetricPoller poller = new JmxMetricPoller(new LocalJmxConnector(),
new ObjectName("java.lang:type=OperatingSystem"), MATCH_NONE);
RegexMetricFilter filter = new RegexMetricFilter(null,
Pattern.compile(name), false, false);
List<Metric> metrics = poller.poll(filter);
assertEquals(metrics.size(), 1);
return metrics.get(0);
}
}