the purpose of making a method private is that it can not be called from outside the declaring class. You might be able to get info about a private method via reflection, but the JVM will not allow you to actually invoke it (AFAIK). So there's no way you can test a private method. In general, private methods are also considered too much of an implementation detail, and too fragile, to be worth testing separately. A common compromise is to make such methods package private, and put the test case class in the same package as to class under test.
HTH, -chris
Ajay Kumar wrote:
I have a controller servlet with many private methods and want to write a testcase for these methods. I tried using reflection for invoking these methods, but got the following report:
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
