Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Fix reporter test, apparently.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantenney committed Jul 26, 2013
1 parent 0d13125 commit 2104768
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/test/java/com/ryantenney/metrics/spring/ReporterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.junit.Assert;
import org.junit.Test;
import org.springframework.aop.support.AopUtils;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.codahale.metrics.ConsoleReporter;
Expand All @@ -42,16 +43,16 @@ public void fakeReporters() throws Throwable {
FakeReporter one = null;
FakeReporter two = null;
try {
MetricRegistry registry = new MetricRegistry();
SharedMetricRegistries.add("reporterTestRegistry", registry);
final MetricRegistry registry = SharedMetricRegistries.getOrCreate("reporterTestRegistry");

ctx = new ClassPathXmlApplicationContext("classpath:fake-reporter-test.xml");
ctx.start();

Thread.sleep(1000);

one = ctx.getBean("fakeReporterOne", FakeReporter.class);
Assert.assertEquals(registry, one.getRegistry());
Assert.assertFalse(AopUtils.isAopProxy(one.getRegistry()));
Assert.assertSame(registry, one.getRegistry());
Assert.assertEquals("milliseconds", one.getDurationUnit());
Assert.assertEquals("second", one.getRateUnit());
Assert.assertEquals(100000000, one.getPeriod());
Expand All @@ -60,7 +61,8 @@ public void fakeReporters() throws Throwable {
Assert.assertTrue(one.isRunning());

two = ctx.getBean("fakeReporterTwo", FakeReporter.class);
Assert.assertEquals(registry, two.getRegistry());
Assert.assertFalse(AopUtils.isAopProxy(one.getRegistry()));
Assert.assertSame(registry, two.getRegistry());
Assert.assertEquals("nanoseconds", two.getDurationUnit());
Assert.assertEquals("hour", two.getRateUnit());
Assert.assertEquals(100000000, two.getPeriod());
Expand Down

0 comments on commit 2104768

Please sign in to comment.