InterviewSolution
Saved Bookmarks
| 1. |
How Do You Test A "private" Method? |
|
Answer» When a METHOD is declared as "private", it can only be accessed within the same class. So there is no way to test a "private" method of a TARGET class from any test class. Hence you NEED to PERFORM unit testing MANUALLY. Or you have to change your method from "private" to "protected". When a method is declared as "private", it can only be accessed within the same class. So there is no way to test a "private" method of a target class from any test class. Hence you need to perform unit testing manually. Or you have to change your method from "private" to "protected". |
|