From d8a99945a2c899f36ba033e464f70d45d91a86bd Mon Sep 17 00:00:00 2001 From: Maple Buice Date: Mon, 11 Dec 2023 15:27:59 -0500 Subject: [PATCH] Remove JavaTimeModule registration --- .../com/hubspot/jinjava/lib/filter/PrettyPrintFilter.java | 2 -- .../hubspot/jinjava/lib/filter/PrettyPrintFilterTest.java | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilter.java b/src/main/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilter.java index 2c59e15c0..41440d367 100644 --- a/src/main/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilter.java +++ b/src/main/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilter.java @@ -1,7 +1,6 @@ package com.hubspot.jinjava.lib.filter; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.hubspot.jinjava.doc.annotations.JinjavaDoc; import com.hubspot.jinjava.doc.annotations.JinjavaParam; import com.hubspot.jinjava.doc.annotations.JinjavaSnippet; @@ -56,7 +55,6 @@ public Object filter(Object var, JinjavaInterpreter interpreter, String... args) interpreter .getConfig() .getObjectMapper() - .registerModule(new JavaTimeModule()) .writerWithDefaultPrettyPrinter() .writeValueAsString(var); } catch (JsonProcessingException e) { diff --git a/src/test/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilterTest.java b/src/test/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilterTest.java index 286a2771e..bb491eb8e 100644 --- a/src/test/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilterTest.java +++ b/src/test/java/com/hubspot/jinjava/lib/filter/PrettyPrintFilterTest.java @@ -3,6 +3,8 @@ import static org.assertj.core.api.Assertions.assertThat; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.hubspot.jinjava.Jinjava; @@ -21,7 +23,10 @@ public class PrettyPrintFilterTest { @Before public void setup() { - JinjavaConfig config = JinjavaConfig.newBuilder().build(); + JinjavaConfig config = JinjavaConfig + .newBuilder() + .withObjectMapper(new ObjectMapper().registerModule(new JavaTimeModule())) + .build(); Jinjava jinjava = new Jinjava(config); Context context = jinjava.getGlobalContext(); i = new JinjavaInterpreter(jinjava, context, config);