I have some private method inside a jar file due to some restriction of visibility to outer class. I just added that jar file through maven dependency. And I want to call that private method and return the value after invoke. but when I tried to execute below code throws NoSuchMethod Exception.
Code:
Method method = BankFlowTestExecutor.class.getDeclaredMethod("executeBatchCommand", String.class);
method.setAccessible(true);
The exception observed as soon as its executed the first line in the above code.
Exception:
java.lang.NoSuchMethodException: com.paypal.test.executeBatchCommand(java.lang.String) at java.lang.Class.getDeclaredMethod(Class.java:2130)
Any leads?
Aucun commentaire:
Enregistrer un commentaire