From e85ed6e67e3a75465ed42de8f9cb70373dbc823d Mon Sep 17 00:00:00 2001 From: Harish Bohara Date: Mon, 20 Jan 2025 17:37:30 +0530 Subject: [PATCH] test - added support for JavaTimeModule --- .../easy/helper/json/JsonUtilsTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 helper/src/test/java/io/gitbub/devlibx/easy/helper/json/JsonUtilsTest.java diff --git a/helper/src/test/java/io/gitbub/devlibx/easy/helper/json/JsonUtilsTest.java b/helper/src/test/java/io/gitbub/devlibx/easy/helper/json/JsonUtilsTest.java new file mode 100644 index 00000000..e3bf130a --- /dev/null +++ b/helper/src/test/java/io/gitbub/devlibx/easy/helper/json/JsonUtilsTest.java @@ -0,0 +1,25 @@ +package io.gitbub.devlibx.easy.helper.json; + + +import lombok.Data; +import org.joda.time.DateTime; +import org.junit.jupiter.api.Test; + +public class JsonUtilsTest { + + @Test + public void asJson() { + // We added Joda time and java.time.Instant support so making sure we do not fail + TestPojo testPojo = new TestPojo(); + testPojo.setInstant(java.time.Instant.now()); + testPojo.setInstantJoda(DateTime.now()); + String json = JsonUtils.asJson(testPojo); + System.out.println(json); + } + + @Data + public static class TestPojo { + private java.time.Instant instant; + private DateTime instantJoda; + } +} \ No newline at end of file