use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindISODate.
@Test
public void testBindISODate() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("isoDate", "2009-10-31");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("2009-10-31", binder.getBindingResult().getFieldValue("isoDate"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindDateWithoutErrorFallingBackToDateConstructor.
@Test
public void testBindDateWithoutErrorFallingBackToDateConstructor() {
DataBinder binder = new DataBinder(new JodaTimeBean());
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("date", "Sat, 12 Aug 1995 13:30:00 GMT");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindDateTimeWithSpecificFormatter.
@Test
public void testBindDateTimeWithSpecificFormatter() throws Exception {
JodaTimeFormatterRegistrar registrar = new JodaTimeFormatterRegistrar();
registrar.setDateTimeFormatter(org.joda.time.format.DateTimeFormat.forPattern("yyyyMMddHHmmss"));
setUp(registrar);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("dateTime", "20091031130000");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("20091031130000", binder.getBindingResult().getFieldValue("dateTime"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindYearMonth.
@Test
public void testBindYearMonth() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("yearMonth", "2007-12");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertTrue(binder.getBindingResult().getFieldValue("yearMonth").toString().equals("2007-12"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindNestedLocalDateAnnotated.
@Test
public void testBindNestedLocalDateAnnotated() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("children[0].localDateAnnotated", "Oct 31, 2009");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("children[0].localDateAnnotated"));
}
Aggregations