Spring uses Joda-Time 2.0's specific parseLocalDate/parseLocalTime/parseLocalDateTime methods now
Issue: SPR-11014
This commit is contained in:
@@ -16,11 +16,6 @@
|
||||
|
||||
package org.springframework.format.datetime.joda;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -37,6 +32,7 @@ import org.joda.time.MutableDateTime;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.MutablePropertyValues;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.core.convert.TypeDescriptor;
|
||||
@@ -46,6 +42,9 @@ import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.format.support.FormattingConversionService;
|
||||
import org.springframework.validation.DataBinder;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Keith Donald
|
||||
* @author Juergen Hoeller
|
||||
@@ -236,21 +235,10 @@ public class JodaTimeFormattingTests {
|
||||
@Test
|
||||
public void testBindLocalDateTimeAnnotated() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.add("localDateTimeAnnotated", "Saturday, October 31, 2009 12:00:00 PM ");
|
||||
propertyValues.add("localDateTimeAnnotated", "Oct 31, 2009 12:00 PM");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("Saturday, October 31, 2009 12:00:00 PM ", binder.getBindingResult().getFieldValue(
|
||||
"localDateTimeAnnotated"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindLocalDateTimeAnnotatedLong() {
|
||||
MutablePropertyValues propertyValues = new MutablePropertyValues();
|
||||
propertyValues.add("localDateTimeAnnotatedLong", "October 31, 2009 12:00:00 PM ");
|
||||
binder.bind(propertyValues);
|
||||
assertEquals(0, binder.getBindingResult().getErrorCount());
|
||||
assertEquals("October 31, 2009 12:00:00 PM ", binder.getBindingResult().getFieldValue(
|
||||
"localDateTimeAnnotatedLong"));
|
||||
assertEquals("Oct 31, 2009 12:00 PM", binder.getBindingResult().getFieldValue("localDateTimeAnnotated"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -510,12 +498,9 @@ public class JodaTimeFormattingTests {
|
||||
|
||||
private LocalDateTime localDateTime;
|
||||
|
||||
@DateTimeFormat(style="FF")
|
||||
@DateTimeFormat(style="MS")
|
||||
private LocalDateTime localDateTimeAnnotated;
|
||||
|
||||
@DateTimeFormat(style="LL")
|
||||
private LocalDateTime localDateTimeAnnotatedLong;
|
||||
|
||||
private DateTime dateTime;
|
||||
|
||||
@DateTimeFormat(style="MS")
|
||||
@@ -612,14 +597,6 @@ public class JodaTimeFormattingTests {
|
||||
this.localDateTimeAnnotated = localDateTimeAnnotated;
|
||||
}
|
||||
|
||||
public LocalDateTime getLocalDateTimeAnnotatedLong() {
|
||||
return localDateTimeAnnotatedLong;
|
||||
}
|
||||
|
||||
public void setLocalDateTimeAnnotatedLong(LocalDateTime localDateTimeAnnotatedLong) {
|
||||
this.localDateTimeAnnotatedLong = localDateTimeAnnotatedLong;
|
||||
}
|
||||
|
||||
public DateTime getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user