Design Pattern to find if method parameter is typecast inside the method
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.
getDeclarationAsString()
getParameters()
MethodDeclaration
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I need more code to understand your problem correctly..
– Roman
Aug 30 at 12:07