use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindDuration.
@Test
public void testBindDuration() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("duration", "PT8H6M12.345S");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertTrue(binder.getBindingResult().getFieldValue("duration").toString().equals("PT8H6M12.345S"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindLocalDateArray.
@Test
public void testBindLocalDateArray() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("localDate", new String[] { "10/31/09" });
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindLocalDateAnnotatedWithDirectFieldAccess.
@Test
public void testBindLocalDateAnnotatedWithDirectFieldAccess() {
binder.initDirectFieldAccess();
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("localDateAnnotated", "Oct 31, 2009");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class DateTimeFormattingTests method testBindLocalTimeWithSpecificFormatter.
@Test
public void testBindLocalTimeWithSpecificFormatter() throws Exception {
DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
registrar.setTimeFormatter(DateTimeFormatter.ofPattern("HHmmss"));
setUp(registrar);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("localTime", "130000");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("130000", binder.getBindingResult().getFieldValue("localTime"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class NumberFormattingTests method testPatternListFormatting.
@Test
public void testPatternListFormatting() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("patternList", new String[] { "1,25.00", "2,35.00" });
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("1,25.00", binder.getBindingResult().getFieldValue("patternList[0]"));
assertEquals("2,35.00", binder.getBindingResult().getFieldValue("patternList[1]"));
propertyValues = new MutablePropertyValues();
propertyValues.add("patternList[0]", "1,25.00");
propertyValues.add("patternList[1]", "2,35.00");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("1,25.00", binder.getBindingResult().getFieldValue("patternList[0]"));
assertEquals("2,35.00", binder.getBindingResult().getFieldValue("patternList[1]"));
}
Aggregations