Efficient ISO_LOCAL_* variants for printing LocalDate/LocalTime/LocalDateTime
Issue: SPR-14958
This commit is contained in:
@@ -311,6 +311,15 @@ public class DateTimeFormattingTests {
|
||||
|
||||
@Test
|
||||
public void testBindISOTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.add("isoTime", "12:00:00");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("12:00:00", binder.getBindingResult().getFieldValue("isoTime"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindISOTimeWithZone() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.add("isoTime", "12:00:00.000-05:00");
|
||||
binder.bind(propertyValues);
|
||||
@@ -320,6 +329,15 @@ public class DateTimeFormattingTests {
|
||||
|
||||
@Test
|
||||
public void testBindISODateTime() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.add("isoDateTime", "2009-10-31T12:00:00");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("2009-10-31T12:00:00", binder.getBindingResult().getFieldValue("isoDateTime"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindISODateTimeWithZone() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.add("isoDateTime", "2009-10-31T12:00:00.000Z");
|
||||
binder.bind(propertyValues);
|
||||
@@ -386,29 +404,29 @@ public class DateTimeFormattingTests {
|
||||
|
||||
private LocalDate localDate;
|
||||
|
||||
@DateTimeFormat(style="M-")
|
||||
@DateTimeFormat(style = "M-")
|
||||
private LocalDate localDateAnnotated;
|
||||
|
||||
private LocalTime localTime;
|
||||
|
||||
@DateTimeFormat(style="-M")
|
||||
@DateTimeFormat(style = "-M")
|
||||
private LocalTime localTimeAnnotated;
|
||||
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
@DateTimeFormat(style="MM")
|
||||
@DateTimeFormat(style = "MM")
|
||||
private LocalDateTime localDateTimeAnnotated;
|
||||
|
||||
@DateTimeFormat(pattern="M/d/yy h:mm a")
|
||||
@DateTimeFormat(pattern = "M/d/yy h:mm a")
|
||||
private LocalDateTime dateTimeAnnotatedPattern;
|
||||
|
||||
@DateTimeFormat(iso=ISO.DATE)
|
||||
@DateTimeFormat(iso = ISO.DATE)
|
||||
private LocalDate isoDate;
|
||||
|
||||
@DateTimeFormat(iso=ISO.TIME)
|
||||
@DateTimeFormat(iso = ISO.TIME)
|
||||
private LocalTime isoTime;
|
||||
|
||||
@DateTimeFormat(iso=ISO.DATE_TIME)
|
||||
@DateTimeFormat(iso = ISO.DATE_TIME)
|
||||
private LocalDateTime isoDateTime;
|
||||
|
||||
private Instant instant;
|
||||
|
||||
Reference in New Issue
Block a user