Skip to content

Commit

Permalink
test - added support for JavaTimeModule
Browse files Browse the repository at this point in the history
  • Loading branch information
harishb2k committed Jan 20, 2025
1 parent 40d0255 commit e85ed6e
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit e85ed6e

Please sign in to comment.