mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
add TemporalAccessorSerializer
This commit is contained in:
@@ -5,6 +5,8 @@ import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.Month;
|
||||
|
||||
/**
|
||||
@@ -29,6 +31,30 @@ public class Issue2090Test {
|
||||
Assert.assertNotNull(jsonObject.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toBeanLocalDateTest(){
|
||||
LocalDate d = LocalDate.now();
|
||||
final JSONObject obj = JSONUtil.parseObj(d);
|
||||
LocalDate d2 = obj.toBean(LocalDate.class);
|
||||
Assert.assertEquals(d, d2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toBeanLocalDateTimeTest(){
|
||||
LocalDateTime d = LocalDateTime.now();
|
||||
final JSONObject obj = JSONUtil.parseObj(d);
|
||||
LocalDateTime d2 = obj.toBean(LocalDateTime.class);
|
||||
Assert.assertEquals(d, d2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toBeanLocalTimeTest(){
|
||||
LocalTime d = LocalTime.now();
|
||||
final JSONObject obj = JSONUtil.parseObj(d);
|
||||
LocalTime d2 = obj.toBean(LocalTime.class);
|
||||
Assert.assertEquals(d, d2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void monthTest(){
|
||||
final JSONObject jsonObject = new JSONObject();
|
||||
|
Reference in New Issue
Block a user