@@ -625,6 +625,29 @@ public void setAsText(String text) throws IllegalArgumentException {
625625 assertEquals ("value" , tb .getName ());
626626 }
627627
628+ public void testJavaBeanPropertyConventions () {
629+ Book book = new Book ();
630+ DataBinder binder = new DataBinder (book );
631+
632+ MutablePropertyValues pvs = new MutablePropertyValues ();
633+ pvs .add ("title" , "my book" );
634+ pvs .add ("ISBN" , "1234" );
635+ pvs .add ("NInStock" , "5" );
636+ binder .bind (pvs );
637+ assertEquals ("my book" , book .getTitle ());
638+ assertEquals ("1234" , book .getISBN ());
639+ assertEquals (5 , book .getNInStock ());
640+
641+ pvs = new MutablePropertyValues ();
642+ pvs .add ("Title" , "my other book" );
643+ pvs .add ("iSBN" , "6789" );
644+ pvs .add ("nInStock" , "0" );
645+ binder .bind (pvs );
646+ assertEquals ("my other book" , book .getTitle ());
647+ assertEquals ("6789" , book .getISBN ());
648+ assertEquals (0 , book .getNInStock ());
649+ }
650+
628651 public void testValidatorNoErrors () {
629652 TestBean tb = new TestBean ();
630653 tb .setAge (33 );
@@ -1336,6 +1359,40 @@ public void testTrackDisallowedFields() throws Exception {
13361359 }
13371360
13381361
1362+ private static class Book {
1363+
1364+ private String Title ;
1365+
1366+ private String ISBN ;
1367+
1368+ private int nInStock ;
1369+
1370+ public String getTitle () {
1371+ return Title ;
1372+ }
1373+
1374+ public void setTitle (String title ) {
1375+ Title = title ;
1376+ }
1377+
1378+ public String getISBN () {
1379+ return ISBN ;
1380+ }
1381+
1382+ public void setISBN (String ISBN ) {
1383+ this .ISBN = ISBN ;
1384+ }
1385+
1386+ public int getNInStock () {
1387+ return nInStock ;
1388+ }
1389+
1390+ public void setNInStock (int nInStock ) {
1391+ this .nInStock = nInStock ;
1392+ }
1393+ }
1394+
1395+
13391396 private static class TestBeanValidator implements Validator {
13401397
13411398 public boolean supports (Class clazz ) {
0 commit comments