Package org.soybeanMilk.core.bean

Examples of org.soybeanMilk.core.bean.GenericConvertException


  }
 
  @Test
  public void get_paramScope_singleValue_valueIsNull_targetIsPrimitive() throws Exception
  {
    GenericConvertException re=null;
   
    try
    {
      webObjectSource.get("param.value", int.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue( (re.getMessage().startsWith("can not convert null to primitive type")) );
  }
View Full Code Here


  @Test
  public void convert_nullToPrimitive() throws Exception
  {
    String src=null;
   
    GenericConvertException re=null;
   
    try
    {
      converter.convert(src, int.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue( (re.getMessage().endsWith(" to primitive type "+SbmUtils.toString(int.class))) );
  }
View Full Code Here

  public void convert_noSupportConverter_mapToJavaBean_srcContainInexistentJavaBeanProperty() throws Exception
  {
    Map<String,Object> src=new HashMap<String, Object>();
    src.put("abc", 356);
   
    GenericConvertException re=null;
   
    try
    {
      converter.convert(src, JavaBean.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue(( re.getMessage().startsWith("can not find property \"abc\"") ));
  }
View Full Code Here

  public void convert_noSupportConverter_mapToJavaBean_srcContainInexistentSubJavaBeanProperty() throws Exception
  {
    Map<String,Object> src=new HashMap<String, Object>();
    src.put("javaBean.def", 356);
   
    GenericConvertException re=null;
   
    try
    {
      converter.convert(src, JavaBean2.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue(( re.getMessage().startsWith("can not find property \"def\"") ));
  }
View Full Code Here

   
    src.put("javaBean2Array.id", cmplexCollectionProperty_id);
    src.put("javaBean2Array.name", cmplexCollectionProperty_name);
    src.put("javaBean2Array.notExistsProperty", cmplexCollectionProperty_name);
   
    GenericConvertException re=null;
    try
    {
      converter.convert(src, ComplexJavaBean.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue( (re.getMessage().startsWith("can not find property \"notExistsProperty\"")) );
  }
View Full Code Here

   
    src.put("javaBean2List.id", cmplexCollectionProperty_id);
    src.put("javaBean2List.name", cmplexCollectionProperty_name);
    src.put("javaBean2List.notExistsProperty", cmplexCollectionProperty_name);
   
    GenericConvertException re=null;
   
    try
    {
      converter.convert(src, ComplexJavaBean.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue((re.getMessage().startsWith("can not find property \"notExistsProperty\"")));
  }
View Full Code Here

   
    src.put("javaBean2Set.id", cmplexCollectionProperty_id);
    src.put("javaBean2Set.name", cmplexCollectionProperty_name);
    src.put("javaBean2Set.notExistsProperty", cmplexCollectionProperty_name);
   
    GenericConvertException re=null;
   
    try
    {
      converter.convert(src, ComplexJavaBean.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue((re.getMessage().startsWith("can not find property \"notExistsProperty\"")));
  }
View Full Code Here

  {
    Map<String,Object> src=new HashMap<String, Object>();
   
    src.put("0.javaBean2Map.illegalKey.id", "1");
   
    GenericConvertException re=null;
    try
    {
      converter.convert(src, ComplexJavaBean[].class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue(( re.getMessage().startsWith("convert \"illegalKey\" in key \"0.javaBean2Map.illegalKey\" to Map key") ));
  }
View Full Code Here

  }
 
  @Test
  public void getPrimitiveForNull() throws Exception
  {
    GenericConvertException re=null;
    try
    {
      objSource.get("key", int.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue((re.getMessage().startsWith("can not convert null to primitive")));
  }
View Full Code Here

   
    src.put("javaBean2Array.id", cmplexCollectionProperty_id);
    src.put("javaBean2Array.name", cmplexCollectionProperty_name);
    src.put("javaBean2Array.notExistsProperty", cmplexCollectionProperty_name);
   
    GenericConvertException re=null;
    try
    {
      converter.convert(src, ComplexJavaBean.class);
    }
    catch(GenericConvertException e)
    {
      re=e;
    }
   
    Assert.assertTrue( (re.getMessage().startsWith("can not find property \"notExistsProperty\"")) );
  }
View Full Code Here

TOP

Related Classes of org.soybeanMilk.core.bean.GenericConvertException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.