This commit is contained in:
Phillip Webb
2016-12-28 15:23:26 -08:00
parent 97d7ffd8e8
commit 8b69856fc9
22 changed files with 64 additions and 41 deletions

View File

@@ -145,7 +145,7 @@ public class JolokiaAutoConfigurationTests {
Collection<? extends MvcEndpoint> endpoints) {
EndpointHandlerMapping mapping = new EndpointHandlerMapping(endpoints);
mapping.setSecurityInterceptor(
new MvcEndpointSecurityInterceptor(false, Collections.EMPTY_LIST));
new MvcEndpointSecurityInterceptor(false, Collections.emptyList()));
return mapping;
}

View File

@@ -54,8 +54,8 @@ public class PrefixMetricGroupExporterTests {
@Test
public void countersIncremented() {
this.writer.increment("counter.foo", new Delta<Long>("bar", 1L));
this.reader.set("counter", Collections.<Metric<?>>singletonList(
new Metric<Number>("counter.foo.bar", 1)));
this.reader.set("counter", Collections
.<Metric<?>>singletonList(new Metric<Number>("counter.foo.bar", 1)));
this.exporter.setGroups(Collections.singleton("counter.foo"));
this.exporter.export();
assertThat(this.writer.findAll("counter.foo").iterator().next().getValue())
@@ -65,8 +65,7 @@ public class PrefixMetricGroupExporterTests {
@Test
public void unprefixedMetricsNotCopied() {
this.reader.set("foo", Arrays.<Metric<?>>asList(
new Metric<Number>("foo.bar", 2.3),
new Metric<Number>("foo.spam", 1.3)));
new Metric<Number>("foo.bar", 2.3), new Metric<Number>("foo.spam", 1.3)));
this.exporter.setGroups(Collections.singleton("bar"));
this.exporter.export();
assertThat(Iterables.collection(this.writer.groups())).isEmpty();
@@ -84,10 +83,9 @@ public class PrefixMetricGroupExporterTests {
@Test
public void onlyPrefixedMetricsCopied() {
this.reader.set("foo", Arrays.<Metric<?>>asList(
new Metric<Number>("foo.bar", 2.3),
new Metric<Number>("foo.spam", 1.3)));
this.reader.set("foobar", Collections.<Metric<?>>singletonList(
new Metric<Number>("foobar.spam", 1.3)));
new Metric<Number>("foo.bar", 2.3), new Metric<Number>("foo.spam", 1.3)));
this.reader.set("foobar", Collections
.<Metric<?>>singletonList(new Metric<Number>("foobar.spam", 1.3)));
this.exporter.setGroups(Collections.singleton("foo"));
this.exporter.export();
assertThat(Iterables.collection(this.writer.groups())).hasSize(1);

View File

@@ -28,6 +28,8 @@ import static org.assertj.core.api.Assertions.offset;
/**
* Tests for {@link InMemoryMetricRepository}.
*
* @author Dave Syer
*/
public class InMemoryMetricRepositoryTests {

View File

@@ -29,12 +29,13 @@ import org.springframework.boot.actuate.metrics.writer.Delta;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests for {@link InMemoryMultiMetricRepository}.
*
* @author Dave Syer
*/
public class InMemoryMultiMetricRepositoryTests {
private final InMemoryMultiMetricRepository repository =
new InMemoryMultiMetricRepository();
private final InMemoryMultiMetricRepository repository = new InMemoryMultiMetricRepository();
@Test
public void registeredPrefixCounted() {