Multiple choice technology testing

How to do unit test for one private method?

  1. a.) Using the Mock class, related to corresponding Test class

  2. b.) Using the reflection if using Jdk 1.3 or higher version

  3. c.) Both a.) & b.)

  4. d.) No way to test it

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Private methods can be unit tested using Java Reflection to bypass access modifiers, or by using mocking frameworks and testing subclass/helper structures. Thus, both options are valid approaches.