-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test - added support for JavaTimeModule
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
helper/src/test/java/io/gitbub/devlibx/easy/helper/json/JsonUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |