diff --git a/metrics-core/pom.xml b/metrics-core/pom.xml
index fdd893e8e5..a57af5340e 100644
--- a/metrics-core/pom.xml
+++ b/metrics-core/pom.xml
@@ -36,12 +36,6 @@
slf4j-api
${slf4j.version}
-
- org.hamcrest
- hamcrest-core
- ${hamcrest.version}
- test
-
org.junit.jupiter
junit-jupiter-api
diff --git a/metrics-core/src/test/java/io/dropwizard/metrics5/SlidingTimeWindowMovingAveragesTest.java b/metrics-core/src/test/java/io/dropwizard/metrics5/SlidingTimeWindowMovingAveragesTest.java
index 2504460584..bdf33260ba 100644
--- a/metrics-core/src/test/java/io/dropwizard/metrics5/SlidingTimeWindowMovingAveragesTest.java
+++ b/metrics-core/src/test/java/io/dropwizard/metrics5/SlidingTimeWindowMovingAveragesTest.java
@@ -1,15 +1,12 @@
package io.dropwizard.metrics5;
-import static io.dropwizard.metrics5.SlidingTimeWindowMovingAverages.NUMBER_OF_BUCKETS;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.MatcherAssert.assertThat;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.time.Instant;
-import io.dropwizard.metrics5.SlidingTimeWindowMovingAverages;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import static io.dropwizard.metrics5.SlidingTimeWindowMovingAverages.NUMBER_OF_BUCKETS;
+import static org.assertj.core.api.Assertions.assertThat;
class SlidingTimeWindowMovingAveragesTest {
@@ -29,16 +26,16 @@ void normalizeIndex() {
SlidingTimeWindowMovingAverages stwm = new SlidingTimeWindowMovingAverages();
- assertThat(stwm.normalizeIndex(0), is(0));
- assertThat(stwm.normalizeIndex(900), is(0));
- assertThat(stwm.normalizeIndex(9000), is(0));
- assertThat(stwm.normalizeIndex(-900), is(0));
+ assertThat(stwm.normalizeIndex(0)).isEqualTo(0);
+ assertThat(stwm.normalizeIndex(900)).isEqualTo(0);
+ assertThat(stwm.normalizeIndex(9000)).isEqualTo(0);
+ assertThat(stwm.normalizeIndex(-900)).isEqualTo(0);
- assertThat(stwm.normalizeIndex(1), is(1));
+ assertThat(stwm.normalizeIndex(1)).isEqualTo(1);
- assertThat(stwm.normalizeIndex(899), is(899));
- assertThat(stwm.normalizeIndex(-1), is(899));
- assertThat(stwm.normalizeIndex(-901), is(899));
+ assertThat(stwm.normalizeIndex(899)).isEqualTo(899);
+ assertThat(stwm.normalizeIndex(-1)).isEqualTo(899);
+ assertThat(stwm.normalizeIndex(-901)).isEqualTo(899);
}
@Test
@@ -46,8 +43,8 @@ void calculateIndexOfTick() {
SlidingTimeWindowMovingAverages stwm = new SlidingTimeWindowMovingAverages(clock);
- assertThat(stwm.calculateIndexOfTick(Instant.ofEpochSecond(0L)), is(0));
- assertThat(stwm.calculateIndexOfTick(Instant.ofEpochSecond(1L)), is(1));
+ assertThat(stwm.calculateIndexOfTick(Instant.ofEpochSecond(0L))).isEqualTo(0);
+ assertThat(stwm.calculateIndexOfTick(Instant.ofEpochSecond(1L))).isEqualTo(1);
}
@Test
@@ -64,11 +61,11 @@ void mark_max_without_cleanup() {
}
// verify that no cleanup happened yet
- assertThat(movingAverages.oldestBucketTime, is(Instant.ofEpochSecond(0L)));
+ assertThat(movingAverages.oldestBucketTime).isEqualTo(Instant.ofEpochSecond(0L));
- assertThat(meter.getOneMinuteRate(), is(60.0));
- assertThat(meter.getFiveMinuteRate(), is(300.0));
- assertThat(meter.getFifteenMinuteRate(), is(900.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(60.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(300.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(900.0);
}
@Test
@@ -85,11 +82,11 @@ void mark_first_cleanup() {
}
// verify that at least one cleanup happened
- assertThat(movingAverages.oldestBucketTime, not(is(Instant.ofEpochSecond(0L))));
+ assertThat(movingAverages.oldestBucketTime).isNotEqualTo(Instant.EPOCH);
- assertThat(meter.getOneMinuteRate(), is(60.0));
- assertThat(meter.getFiveMinuteRate(), is(300.0));
- assertThat(meter.getFifteenMinuteRate(), is(900.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(60.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(300.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(900.0);
}
@Test
@@ -103,10 +100,10 @@ void mark_10_values() {
meter.mark();
}
- assertThat(meter.getCount(), is(10L));
- assertThat(meter.getOneMinuteRate(), is(10.0));
- assertThat(meter.getFiveMinuteRate(), is(10.0));
- assertThat(meter.getFifteenMinuteRate(), is(10.0));
+ assertThat(meter.getCount()).isEqualTo(10L);
+ assertThat(meter.getOneMinuteRate()).isEqualTo(10.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(10.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(10.0);
}
@Test
@@ -118,9 +115,9 @@ void mark_1000_values() {
}
// only 60/300/900 of the 1000 events took place in the last 1/5/15 minute(s)
- assertThat(meter.getOneMinuteRate(), is(60.0));
- assertThat(meter.getFiveMinuteRate(), is(300.0));
- assertThat(meter.getFifteenMinuteRate(), is(900.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(60.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(300.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(900.0);
}
@Test
@@ -130,9 +127,9 @@ void cleanup_pause_shorter_than_window() {
// no mark for three minutes
clock.addSeconds(180);
- assertThat(meter.getOneMinuteRate(), is(0.0));
- assertThat(meter.getFiveMinuteRate(), is(10.0));
- assertThat(meter.getFifteenMinuteRate(), is(10.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(0.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(10.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(10.0);
}
@Test
@@ -144,15 +141,15 @@ void cleanup_window_wrap_around() {
// and query at 15:30 minutes (the bucket index must have wrapped around)
clock.addSeconds(50);
- assertThat(meter.getOneMinuteRate(), is(10.0));
- assertThat(meter.getFiveMinuteRate(), is(10.0));
- assertThat(meter.getFifteenMinuteRate(), is(10.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(10.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(10.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(10.0);
// and query at 30:10 minutes (the bucket index must have wrapped around for the second time)
clock.addSeconds(880);
- assertThat(meter.getOneMinuteRate(), is(0.0));
- assertThat(meter.getFiveMinuteRate(), is(0.0));
- assertThat(meter.getFifteenMinuteRate(), is(0.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(0.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(0.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(0.0);
}
@Test
@@ -162,8 +159,8 @@ void cleanup_pause_longer_than_two_windows() {
// after forty minutes all rates should be zero
clock.addSeconds(2400);
- assertThat(meter.getOneMinuteRate(), is(0.0));
- assertThat(meter.getFiveMinuteRate(), is(0.0));
- assertThat(meter.getFifteenMinuteRate(), is(0.0));
+ assertThat(meter.getOneMinuteRate()).isEqualTo(0.0);
+ assertThat(meter.getFiveMinuteRate()).isEqualTo(0.0);
+ assertThat(meter.getFifteenMinuteRate()).isEqualTo(0.0);
}
}
\ No newline at end of file
diff --git a/metrics-httpclient/pom.xml b/metrics-httpclient/pom.xml
index 3332422ceb..d93108a17c 100644
--- a/metrics-httpclient/pom.xml
+++ b/metrics-httpclient/pom.xml
@@ -57,12 +57,6 @@
httpclient
${http-client.version}
-
- org.hamcrest
- hamcrest-core
- ${hamcrest.version}
- test
-
org.junit.jupiter
junit-jupiter-api
diff --git a/metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java b/metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java
index 7c2b77285b..fb7cb8d64f 100644
--- a/metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java
+++ b/metrics-httpclient/src/test/java/io/dropwizard/metrics5/httpclient/HttpClientMetricNameStrategiesTest.java
@@ -16,92 +16,89 @@
import static io.dropwizard.metrics5.httpclient.HttpClientMetricNameStrategies.METHOD_ONLY;
import static io.dropwizard.metrics5.httpclient.HttpClientMetricNameStrategies.PATH_AND_METHOD;
import static io.dropwizard.metrics5.httpclient.HttpClientMetricNameStrategies.QUERYLESS_URL_AND_METHOD;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
class HttpClientMetricNameStrategiesTest {
@Test
void methodOnlyWithName() {
- assertThat(METHOD_ONLY.getNameFor("some-service", new HttpGet("/whatever")),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service.get-requests")));
+ assertThat(METHOD_ONLY.getNameFor("some-service", new HttpGet("/whatever")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service.get-requests"));
}
@Test
void methodOnlyWithoutName() {
- assertThat(METHOD_ONLY.getNameFor(null, new HttpGet("/whatever")),
- is(MetricName.build("org.apache.http.client.HttpClient.get-requests")));
+ assertThat(METHOD_ONLY.getNameFor(null, new HttpGet("/whatever")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.get-requests"));
}
@Test
void hostAndMethodWithName() {
- assertThat(HOST_AND_METHOD.getNameFor("some-service", new HttpPost("http://my.host.com/whatever")),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor("some-service", new HttpPost("http://my.host.com/whatever")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service.my.host.com.post-requests"));
}
@Test
void hostAndMethodWithoutName() {
- assertThat(HOST_AND_METHOD.getNameFor(null, new HttpPost("http://my.host.com/whatever")),
- is(MetricName.build("org.apache.http.client.HttpClient.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor(null, new HttpPost("http://my.host.com/whatever")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.my.host.com.post-requests"));
}
@Test
void hostAndMethodWithNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPost("http://my.host.com/whatever"));
- assertThat(HOST_AND_METHOD.getNameFor("some-service", request),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor("some-service", request))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service.my.host.com.post-requests"));
}
@Test
void hostAndMethodWithoutNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPost("http://my.host.com/whatever"));
- assertThat(HOST_AND_METHOD.getNameFor(null, request),
- is(MetricName.build("org.apache.http.client.HttpClient.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor(null, request))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.my.host.com.post-requests"));
}
@Test
void pathAndMethodWithName() {
- assertThat(PATH_AND_METHOD.getNameFor("some-service", new HttpPost("http://my.host.com/whatever/happens")),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service./whatever/happens.post-requests")));
+ assertThat(PATH_AND_METHOD.getNameFor("some-service", new HttpPost("http://my.host.com/whatever/happens")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service./whatever/happens.post-requests"));
}
@Test
void pathAndMethodWithoutName() {
- assertThat(PATH_AND_METHOD.getNameFor(null, new HttpPost("http://my.host.com/whatever/happens")),
- is(MetricName.build("org.apache.http.client.HttpClient./whatever/happens.post-requests")));
+ assertThat(PATH_AND_METHOD.getNameFor(null, new HttpPost("http://my.host.com/whatever/happens")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient./whatever/happens.post-requests"));
}
@Test
void pathAndMethodWithNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPost("http://my.host.com/whatever/happens"));
- assertThat(PATH_AND_METHOD.getNameFor("some-service", request),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service./whatever/happens.post-requests")));
+ assertThat(PATH_AND_METHOD.getNameFor("some-service", request))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service./whatever/happens.post-requests"));
}
@Test
void pathAndMethodWithoutNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPost("http://my.host.com/whatever/happens"));
- assertThat(PATH_AND_METHOD.getNameFor(null, request),
- is(MetricName.build("org.apache.http.client.HttpClient./whatever/happens.post-requests")));
+ assertThat(PATH_AND_METHOD.getNameFor(null, request))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient./whatever/happens.post-requests"));
}
@Test
void querylessUrlAndMethodWithName() {
assertThat(QUERYLESS_URL_AND_METHOD.getNameFor(
- "some-service",
- new HttpPut("https://thing.com:8090/my/path?ignore=this&and=this")),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service.https://thing.com:8090/my/path.put-requests")));
+ "some-service",
+ new HttpPut("https://thing.com:8090/my/path?ignore=this&and=this")))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service.https://thing.com:8090/my/path.put-requests"));
}
@Test
void querylessUrlAndMethodWithNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPut("https://thing.com:8090/my/path?ignore=this&and=this"));
- assertThat(QUERYLESS_URL_AND_METHOD.getNameFor(
- "some-service",
- request),
- is(MetricName.build("org.apache.http.client.HttpClient.some-service.https://thing.com:8090/my/path.put-requests")));
+ assertThat(QUERYLESS_URL_AND_METHOD.getNameFor("some-service", request))
+ .isEqualTo(MetricName.build("org.apache.http.client.HttpClient.some-service.https://thing.com:8090/my/path.put-requests"));
}
private static HttpRequest rewriteRequestURI(HttpRequest request) throws URISyntaxException {
diff --git a/metrics-httpclient5/pom.xml b/metrics-httpclient5/pom.xml
index 4dd59455c9..a8f925ca71 100644
--- a/metrics-httpclient5/pom.xml
+++ b/metrics-httpclient5/pom.xml
@@ -74,12 +74,6 @@
org.apache.httpcomponents.core5
httpcore5
-
- org.hamcrest
- hamcrest-core
- ${hamcrest.version}
- test
-
org.junit.jupiter
junit-jupiter-api
diff --git a/metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/HttpClientMetricNameStrategiesTest.java b/metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/HttpClientMetricNameStrategiesTest.java
index 99ba512031..8f30e7685d 100644
--- a/metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/HttpClientMetricNameStrategiesTest.java
+++ b/metrics-httpclient5/src/test/java/io/dropwizard/metrics5/httpclient5/HttpClientMetricNameStrategiesTest.java
@@ -15,66 +15,63 @@
import static io.dropwizard.metrics5.httpclient5.HttpClientMetricNameStrategies.HOST_AND_METHOD;
import static io.dropwizard.metrics5.httpclient5.HttpClientMetricNameStrategies.METHOD_ONLY;
import static io.dropwizard.metrics5.httpclient5.HttpClientMetricNameStrategies.QUERYLESS_URL_AND_METHOD;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
+import static org.assertj.core.api.Assertions.assertThat;
class HttpClientMetricNameStrategiesTest {
@Test
void methodOnlyWithName() {
- assertThat(METHOD_ONLY.getNameFor("some-service", new HttpGet("/whatever")),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.get-requests")));
+ assertThat(METHOD_ONLY.getNameFor("some-service", new HttpGet("/whatever")))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.get-requests"));
}
@Test
void methodOnlyWithoutName() {
- assertThat(METHOD_ONLY.getNameFor(null, new HttpGet("/whatever")),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.get-requests")));
+ assertThat(METHOD_ONLY.getNameFor(null, new HttpGet("/whatever")))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.get-requests"));
}
@Test
void hostAndMethodWithName() {
- assertThat(HOST_AND_METHOD.getNameFor("some-service", new HttpPost("http://my.host.com/whatever")),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor("some-service", new HttpPost("http://my.host.com/whatever")))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.my.host.com.post-requests"));
}
@Test
void hostAndMethodWithoutName() {
- assertThat(HOST_AND_METHOD.getNameFor(null, new HttpPost("http://my.host.com/whatever")),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor(null, new HttpPost("http://my.host.com/whatever")))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.my.host.com.post-requests"));
}
@Test
void hostAndMethodWithNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPost("http://my.host.com/whatever"));
- assertThat(HOST_AND_METHOD.getNameFor("some-service", request),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor("some-service", request))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.my.host.com.post-requests"));
}
@Test
void hostAndMethodWithoutNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPost("http://my.host.com/whatever"));
- assertThat(HOST_AND_METHOD.getNameFor(null, request),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.my.host.com.post-requests")));
+ assertThat(HOST_AND_METHOD.getNameFor(null, request))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.my.host.com.post-requests"));
}
@Test
void querylessUrlAndMethodWithName() {
assertThat(QUERYLESS_URL_AND_METHOD.getNameFor(
- "some-service",
- new HttpPut("https://thing.com:8090/my/path?ignore=this&and=this")),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.https://thing.com:8090/my/path.put-requests")));
+ "some-service",
+ new HttpPut("https://thing.com:8090/my/path?ignore=this&and=this")))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.https://thing.com:8090/my/path.put-requests"));
}
@Test
void querylessUrlAndMethodWithNameInWrappedRequest() throws URISyntaxException {
HttpRequest request = rewriteRequestURI(new HttpPut("https://thing.com:8090/my/path?ignore=this&and=this"));
- assertThat(QUERYLESS_URL_AND_METHOD.getNameFor(
- "some-service",
- request),
- is(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.https://thing.com:8090/my/path.put-requests")));
+ assertThat(QUERYLESS_URL_AND_METHOD.getNameFor("some-service", request))
+ .isEqualTo(MetricName.build("org.apache.hc.client5.http.classic.HttpClient.some-service.https://thing.com:8090/my/path.put-requests"));
}
private static HttpRequest rewriteRequestURI(HttpRequest request) throws URISyntaxException {
diff --git a/metrics-legacy-adapter/pom.xml b/metrics-legacy-adapter/pom.xml
index ef63de22dc..08d18a1ba6 100644
--- a/metrics-legacy-adapter/pom.xml
+++ b/metrics-legacy-adapter/pom.xml
@@ -33,12 +33,6 @@
slf4j-api
${slf4j.version}
-
- org.hamcrest
- hamcrest-core
- ${hamcrest.version}
- test
-
org.junit.jupiter
junit-jupiter-api
diff --git a/pom.xml b/pom.xml
index e23147a37c..28d1e490a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,6 @@
3.24.2
1.14.10
5.8.0
- 1.3
3.14.0
3.11.0
2.23.0