tearDown();
System.setProperty(StatsCollectorFactoryCoda.environmentPrefixSystemPropertyName,"Hello.");
setUp();
StatsCollectorFactoryCoda.MetricNamingStrategy strategy = statsCollectorFactory.getNamingStrategy();
ClusterId clusterId = new ClusterId("app","cluster");
MetricName name = strategy.createName(clusterId, "metric");
assertEquals("metric", name.getName());
assertEquals("app-cluster", name.getGroup());
assertTrue(strategy.buildPrefix(clusterId, new Destination() { @Override public String toString() { return "destination"; } }).startsWith("Hello."));
// make sure setting the environment prefix doesn't effect the -D option
statsCollectorFactory.setEnvironmentPrefix("otherEnvPrefix");
assertTrue(strategy.buildPrefix(clusterId, new Destination() { @Override public String toString() { return "destination"; } }).startsWith("Hello."));