added test for invalid binding to ClassLoader

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3434 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2010-06-20 19:11:36 +00:00
parent a139f3b337
commit 9e57fc0ff9
1 changed files with 16 additions and 0 deletions

View File

@ -225,6 +225,22 @@ public class DataBinderTests extends TestCase {
}
}
public void testBindingWithSystemFieldError() throws Exception {
TestBean rod = new TestBean();
DataBinder binder = new DataBinder(rod, "person");
MutablePropertyValues pvs = new MutablePropertyValues();
pvs.add("class.classLoader.URLs[0]", "http://myserver");
binder.setIgnoreUnknownFields(false);
try {
binder.bind(pvs);
fail("Should have thrown NotWritablePropertyException");
}
catch (NotWritablePropertyException ex) {
assertTrue(ex.getMessage().contains("classLoader"));
}
}
public void testBindingWithErrorsAndCustomEditors() throws Exception {
TestBean rod = new TestBean();
DataBinder binder = new DataBinder(rod, "person");