summaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-11-23 16:07:43 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2023-11-23 16:12:51 +0100
commitef535f6c51393d945d9fe07de38de224d5ae443f (patch)
tree2f5976537a200aebbf6644b8e1ef93f2c669319d /container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java
parentf966346429c85fc31c8ea962b518e02a19f77f46 (diff)
jackson 2.16 changes some of its default settings so we consolidate our use of the ObjectMapper.
Unless special options are used, use a common instance, or create via factory metod.
Diffstat (limited to 'container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java')
-rw-r--r--container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java b/container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java
index e206188dcd8..9e0f9685328 100644
--- a/container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java
+++ b/container-core/src/test/java/com/yahoo/container/handler/metrics/PrometheusV1HandlerTest.java
@@ -1,8 +1,8 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.handler.metrics;
+import ai.vespa.json.Jackson;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.github.tomakehurst.wiremock.junit5.WireMockExtension;
import com.yahoo.container.jdisc.RequestHandlerTestDriver;
@@ -28,8 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class PrometheusV1HandlerTest {
- private static final ObjectMapper jsonMapper = new ObjectMapper();
-
private static final String URI_BASE = "http://localhost";
private static final String V1_URI = URI_BASE + PrometheusV1Handler.V1_PATH;
@@ -76,7 +74,7 @@ public class PrometheusV1HandlerTest {
@Test
void v1_response_contains_values_uri() throws Exception {
String response = testDriver.sendRequest(V1_URI).readAll();
- JsonNode root = jsonMapper.readTree(response);
+ JsonNode root = Jackson.mapper().readTree(response);
assertTrue(root.has("resources"));
ArrayNode resources = (ArrayNode) root.get("resources");
@@ -96,7 +94,7 @@ public class PrometheusV1HandlerTest {
@Test
void invalid_path_yields_error_response() throws Exception {
String response = testDriver.sendRequest(V1_URI + "/invalid").readAll();
- JsonNode root = jsonMapper.readTree(response);
+ JsonNode root = Jackson.mapper().readTree(response);
assertTrue(root.has("error"));
assertTrue(root.get("error").textValue().startsWith("No content"));
}