use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindLocalDateWithSpecificStyle.
@Test
public void testBindLocalDateWithSpecificStyle() throws Exception {
JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
registrar.setDateStyle("L");
setUp(registrar);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("localDate", "October 31, 2009");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("October 31, 2009", binder.getBindingResult().getFieldValue("localDate"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindDateTimeAnnotatedDefault.
@Test
public void testBindDateTimeAnnotatedDefault() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("dateTimeAnnotatedDefault", new DateTime(2009, 10, 31, 12, 0, ISOChronology.getInstanceUTC()));
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
String value = binder.getBindingResult().getFieldValue("dateTimeAnnotatedDefault").toString();
assertTrue(value.startsWith("10/31/09"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindLocalDateTimeAnnotated.
@Test
public void testBindLocalDateTimeAnnotated() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("localDateTimeAnnotated", LocalDateTime.of(2009, 10, 31, 12, 0));
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
String value = binder.getBindingResult().getFieldValue("localDateTimeAnnotated").toString();
assertTrue(value.startsWith("Oct 31, 2009"));
assertTrue(value.endsWith("12:00:00 PM"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindISOTimeWithZone.
@Test
public void testBindISOTimeWithZone() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("isoTime", "12:00:00.000-05:00");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("12:00:00", binder.getBindingResult().getFieldValue("isoTime"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindISODateTime.
@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"));
}
Aggregations