User Tools

Site Tools


tips:java:testprivatemethods
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


tips:java:testprivatemethods [2009/06/08 12:17] (current) – created erik
Line 1: Line 1:
 +====== Testing Private Methods ======
  
 +It can be done using the Refletion API:
 +
 +<code java>
 +Method myMethod = MyClass.class.getDeclaredMethod("myMethod", ...);
 +myMethod.setAccessible(true);
 +
 +myMethod.invoke(...);
 +</code>
 +
 +For more information, see this [[http://erik.thauvin.net/blog/news.jsp?date=2006-01-29#418|tip]] I wrote
tips/java/testprivatemethods.txt · Last modified: 2009/06/08 12:17 by erik