jeudi 30 août 2018

Design Pattern to find if method parameter is typecast inside the method

I am writing a UT generator, which will generate Junit Test Cases for Java files already present.

I am running into problems when the parameter of a method is type casted to a child type inside the method. This is because my test case is generated using the method signature, but when the generatedtest case is run, the type casting fails from supertype class to subtype class.

I need to understand how I can parse the method to find if the parameter is typecasted inside the method.

I have got the method body using getDeclarationAsString() method and method parameters using getParameters() method of MethodDeclaration class.

Aucun commentaire:

Enregistrer un commentaire