added forNestedType(MethodParameter) for resolution of nested parameter types for collection, array, and map parameter types

This commit is contained in:
Keith Donald
2011-01-06 21:59:34 +00:00
parent 61cfb96d95
commit 4c9731d572
6 changed files with 91 additions and 35 deletions

View File

@@ -116,7 +116,6 @@ public class NumberFormattingTests {
}
@Test
@Ignore
public void testPatternArrayFormatting() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("patternArray", new String[] {"1,25.00", "2,35.00"});
@@ -135,7 +134,6 @@ public class NumberFormattingTests {
}
@Test
@Ignore
public void testPatternListFormatting() {
MutablePropertyValues propertyValues = new MutablePropertyValues();
propertyValues.add("patternList", new String[] {"1,25.00", "2,35.00"});
@@ -154,15 +152,24 @@ public class NumberFormattingTests {
}
@Test
@Ignore
public void testPatternList2Formatting() {
public void testPatternList2FormattingListElement() {
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", binder.getBindingResult().getFieldValue("patternList[0]"));
assertEquals("2,35.00", binder.getBindingResult().getFieldValue("patternList[1]"));
assertEquals("1,25.00", binder.getBindingResult().getFieldValue("patternList2[0]"));
assertEquals("2,35.00", binder.getBindingResult().getFieldValue("patternList2[1]"));
}
@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"));
}

View File

@@ -382,7 +382,7 @@ public class DataBinderTests extends TestCase {
try {
binder.bind(pvs);
assertEquals(new Integer(1), tb.getIntegerList().get(0));
// TODO add back assertEquals("1", binder.getBindingResult().getFieldValue("integerList[0]"));
assertEquals("1", binder.getBindingResult().getFieldValue("integerList[0]"));
}
finally {
LocaleContextHolder.resetLocaleContext();