use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class NumberFormattingTests method testPatternList2FormattingList.
@Test
public void testPatternList2FormattingList() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("patternList2[0]", "1,25.00");
propertyValues.add("patternList2[1]", "2,35.00");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("1,25.00,2,35.00", binder.getBindingResult().getFieldValue("patternList2"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class NumberFormattingTests method testPatternFormatting.
@Test
public void testPatternFormatting() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("pattern", "1,25.00");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("1,25.00", binder.getBindingResult().getFieldValue("pattern"));
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class MoneyFormattingTests method testAmountWithNumberFormat2.
@Test
public void testAmountWithNumberFormat2() {
FormattedMoneyHolder2 bean = new FormattedMoneyHolder2();
DataBinder binder = new DataBinder(bean);
binder.setConversionService(conversionService);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("amount", "10.50");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("10.5", binder.getBindingResult().getFieldValue("amount"));
assertTrue(bean.getAmount().getNumber().doubleValue() == 10.5d);
assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class MoneyFormattingTests method testAmountWithNumberFormat3.
@Test
public void testAmountWithNumberFormat3() {
FormattedMoneyHolder3 bean = new FormattedMoneyHolder3();
DataBinder binder = new DataBinder(bean);
binder.setConversionService(conversionService);
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("amount", "10%");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("10%", binder.getBindingResult().getFieldValue("amount"));
assertTrue(bean.getAmount().getNumber().doubleValue() == 0.1d);
assertEquals("USD", bean.getAmount().getCurrency().getCurrencyCode());
}
use of org.springframework.beans.MutablePropertyValues in project spring-framework by spring-projects.
the class JodaTimeFormattingTests method testBindCalendarAnnotated.
@Test
public void testBindCalendarAnnotated() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("calendarAnnotated", "10/31/09");
binder.bind(propertyValues);
assertEquals(0, binder.getBindingResult().getErrorCount());
assertEquals("10/31/09", binder.getBindingResult().getFieldValue("calendarAnnotated"));
}
Aggregations