mvel icon indicating copy to clipboard operation
mvel copied to clipboard

PropertyAccess.setProperty doesn't convert Collection's value type

Open wuhaixing opened this issue 13 years ago • 0 comments

I just add a test to PropertyAccessTests in MVEL


  public class Datas {
         private List<Long> ids = new ArrayList<Long>();
         public void setIds(List<Long> ids) {
             this.ids = ids;
         }
         public List<Long> getIds() {
             return this.ids;
         }

  }
  public void testBindingConvert() {

      Datas datas = new Datas();
      List values = new ArrayList();
      values.add("1");
      values.add("2");
      values.add("3");
      MVEL.setProperty(datas, "ids", values);

      assertEquals(new Long(1),datas.getIds().get(0));

  }

and got this:

testBindingConvert(org.mvel2.tests.core.PropertyAccessTests): expected:<1> but was:<1>

wuhaixing avatar Jul 27 '11 14:07 wuhaixing