I need to test a java class with a huge number of functions. I'm using cucumber so I could call a function that gets only a parameter or I could call another with 7 or 8 parameters (all of them are string, fortunatelly).
So I make a table like that:
| objectname | funcname | [varX] |
| objectname | funcname2 | [varY] |
| objectname | funcname3 | [varZ, varX, varY] |
| objectname | funcname | [varZ] |
In the code I could convert the third column in a variable list of parameters, that is easy, but my problem is to call the getMethod function. I don't want to define a list of:
objectName.getClass().getMethod("functionName", varList.get(0).getClass());
objectName.getClass().getMethod("functionName", varList.get(0).getClass(), varList.get(1).getClass());
objectName.getClass().getMethod("functionName", varList.get(0).getClass(), varList.get(1).getClass(), varList.get(2).getClass());
....
Is there a way to solve it with something like
objectName.getClass().getMethod("functionName", list2ArgList);
? Sorry for not to be more precise.
Aucun commentaire:
Enregistrer un commentaire