Skip to content

Commit

Permalink
Update DropwizardExportsTest.java
Browse files Browse the repository at this point in the history
Signed-off-by: Kinshuk Bairagi <hi@kinsh.uk>
  • Loading branch information
kingster committed Dec 11, 2024
1 parent 65b4ddd commit 2e0b416
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.data.Offset.offset;
import static org.junit.Assert.assertThrows;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import com.codahale.metrics.*;
import io.prometheus.metrics.expositionformats.OpenMetricsTextFormatWriter;
Expand All @@ -25,7 +26,10 @@ class DropwizardExportsTest {
@BeforeEach
public void setUp() {
metricRegistry = new MetricRegistry();
DropwizardExports.builder().dropwizardRegistry(metricRegistry).register(registry);
DropwizardExports.builder()
.dropwizardRegistry(metricRegistry)
.metricFilter(MetricFilter.ALL)
.register(registry);
}

@Test
Expand All @@ -35,6 +39,12 @@ public void testBuilderThrowsErrorOnNullRegistry() {
() -> DropwizardExports.builder().dropwizardRegistry(null).register(registry));
}

@Test
public void testBuilderCreatesOkay() {
assertDoesNotThrow(
() -> DropwizardExports.builder().dropwizardRegistry(metricRegistry).register());
}

@Test
public void testCounter() {
metricRegistry.counter("foo.bar").inc(1);
Expand Down

0 comments on commit 2e0b416

Please sign in to comment.