I am facing method invocation exception while calling invoke method as below
try {
method = obj.getClass().getDeclaredMethod(new StringBuilder("get").append(id).toString());
ret = method.invoke(obj);
} catch (Exception e) {
String excepText = "Bad record: FileName: ["+fileName+"] Invalid Data [" + trimmedMrd + "]\n Exception :[" +e +"]"+id+" is not valid in record";
Here the value of id="direction" so method getDirection() is invoked which return an Enum and i have intentionally passed a wrong enum value to run a test case here . But the cause of exception is visible only in the target variable within the exception object ( as visible in debug mode) :
target:org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: string value 'Dsselivered' is not a valid enumeration value for Direction
But i am not bale to find any method to obtain this object. Is there any way out to get this target?
Aucun commentaire:
Enregistrer un commentaire