aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java')
-rw-r--r--container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java36
1 files changed, 18 insertions, 18 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java b/container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java
index 6c05af95289..019fc1e1e78 100644
--- a/container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java
+++ b/container-core/src/test/java/com/yahoo/container/jdisc/state/MetricsPacketsHandlerTest.java
@@ -4,8 +4,8 @@ package com.yahoo.container.jdisc.state;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yahoo.container.jdisc.RequestHandlerTestDriver;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import java.util.ArrayList;
import java.util.List;
@@ -18,8 +18,8 @@ import static com.yahoo.container.jdisc.state.MetricsPacketsHandler.PACKET_SEPAR
import static com.yahoo.container.jdisc.state.MetricsPacketsHandler.STATUS_CODE_KEY;
import static com.yahoo.container.jdisc.state.MetricsPacketsHandler.STATUS_MSG_KEY;
import static com.yahoo.container.jdisc.state.MetricsPacketsHandler.TIMESTAMP_KEY;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author gjoranv
@@ -31,7 +31,7 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
private static MetricsPacketsHandler metricsPacketsHandler;
- @Before
+ @BeforeEach
public void setupHandler() {
metricsPacketsHandlerConfig = new MetricsPacketsHandlerConfig(new MetricsPacketsHandlerConfig.Builder()
.application(APPLICATION_NAME).hostname(HOST_DIMENSION));
@@ -40,20 +40,20 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void status_packet_is_returned_prior_to_first_snapshot() throws Exception {
+ void status_packet_is_returned_prior_to_first_snapshot() throws Exception {
String response = requestAsString("http://localhost/metrics-packets");
List<JsonNode> packets = toJsonPackets(response);
assertEquals(1, packets.size());
JsonNode statusPacket = packets.get(0);
- assertEquals(statusPacket.toString(), APPLICATION_NAME, statusPacket.get(APPLICATION_KEY).asText());
- assertEquals(statusPacket.toString(), 0, statusPacket.get(STATUS_CODE_KEY).asInt());
- assertEquals(statusPacket.toString(), "up", statusPacket.get(STATUS_MSG_KEY).asText());
+ assertEquals(APPLICATION_NAME, statusPacket.get(APPLICATION_KEY).asText(), statusPacket.toString());
+ assertEquals(0, statusPacket.get(STATUS_CODE_KEY).asInt(), statusPacket.toString());
+ assertEquals("up", statusPacket.get(STATUS_MSG_KEY).asText(), statusPacket.toString());
}
@Test
- public void metrics_are_included_after_snapshot() throws Exception {
+ void metrics_are_included_after_snapshot() throws Exception {
createSnapshotWithCountMetric("counter", 1, null);
List<JsonNode> packets = incrementTimeAndGetJsonPackets();
assertEquals(2, packets.size());
@@ -63,7 +63,7 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void metadata_is_included_in_each_metrics_packet() throws Exception {
+ void metadata_is_included_in_each_metrics_packet() throws Exception {
createSnapshotWithCountMetric("counter", 1, null);
List<JsonNode> packets = incrementTimeAndGetJsonPackets();
JsonNode counterPacket = packets.get(1);
@@ -74,16 +74,16 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void timestamp_resolution_is_in_seconds() throws Exception {
+ void timestamp_resolution_is_in_seconds() throws Exception {
createSnapshotWithCountMetric("counter", 1, null);
List<JsonNode> packets = incrementTimeAndGetJsonPackets();
JsonNode counterPacket = packets.get(1);
- assertEquals(SNAPSHOT_INTERVAL/1000L, counterPacket.get(TIMESTAMP_KEY).asLong());
+ assertEquals(SNAPSHOT_INTERVAL / 1000L, counterPacket.get(TIMESTAMP_KEY).asLong());
}
@Test
- public void expected_aggregators_are_output_for_gauge_metrics() throws Exception{
+ void expected_aggregators_are_output_for_gauge_metrics() throws Exception {
var context = StateMetricContext.newInstance(Map.of("dim1", "value1"));
var snapshot = new MetricSnapshot();
snapshot.set(context, "gauge", 0.2);
@@ -98,7 +98,7 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void dimensions_from_context_are_included() throws Exception {
+ void dimensions_from_context_are_included() throws Exception {
var context = StateMetricContext.newInstance(Map.of("dim1", "value1"));
createSnapshotWithCountMetric("counter", 1, context);
@@ -111,7 +111,7 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void metrics_with_identical_dimensions_are_contained_in_the_same_packet() throws Exception {
+ void metrics_with_identical_dimensions_are_contained_in_the_same_packet() throws Exception {
var context = StateMetricContext.newInstance(Map.of("dim1", "value1"));
var snapshot = new MetricSnapshot();
snapshot.add(context, "counter1", 1);
@@ -128,7 +128,7 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void metrics_with_different_dimensions_get_separate_packets() throws Exception {
+ void metrics_with_different_dimensions_get_separate_packets() throws Exception {
var context1 = StateMetricContext.newInstance(Map.of("dim1", "value1"));
var context2 = StateMetricContext.newInstance(Map.of("dim2", "value2"));
var snapshot = new MetricSnapshot();
@@ -141,7 +141,7 @@ public class MetricsPacketsHandlerTest extends StateHandlerTestBase {
}
@Test
- public void host_dimension_only_created_if_absent() throws Exception {
+ void host_dimension_only_created_if_absent() throws Exception {
var context1 = StateMetricContext.newInstance(Map.of("dim1", "value1", "host", "foo.bar"));
var context2 = StateMetricContext.newInstance(Map.of("dim2", "value2"));
var snapshot = new MetricSnapshot();