Examples of ConvertException


Examples of org.soybeanMilk.core.bean.ConvertException

      InvocationExecuteException ite=(InvocationExecuteException)cause;
      msg=ite.getCause().getMessage();
    }
    else if(cause instanceof ConvertExecuteException)
    {
      ConvertException cvte=((ConvertExecuteException)cause).getCause();
     
      if(cvte instanceof ParamConvertException)
      {
        ParamConvertException pce=(ParamConvertException)cvte;
       
        msg="The parameter [name: \""+pce.getParamName()+"\", value: \""+pce.getSourceObject()+"\"]";
       
        Type targetType=pce.getTargetType();
        if(Integer.class.equals(targetType)
            || int.class.equals(targetType))
          msg+=" is not valid integer.";
        else
          msg+=" is invalid";
      }
      else
        msg+=cvte.getMessage();
    }
    else
      msg="unknown error";
   
    return msg+" (\""+execution.getExecutable().getName()+"\")";
View Full Code Here

Examples of org.soybeanMilk.core.bean.ConvertException

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

Examples of org.soybeanMilk.core.bean.ConvertException

  @Test
  public void convert_convertException() throws Exception
  {
    String src="sdf";
   
    ConvertException re=null;
   
    try
    {
      converter.convert(src, Integer.class);
    }
    catch(ConvertException e)
    {
      re=e;
    }
   
    Assert.assertEquals(src, re.getSourceObject());
    Assert.assertEquals(Integer.class, re.getTargetType());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.