Multiple choice technology testing

How to do unit test for one protected method?

  1. a.) Reflection provides the option to do this.

  2. b.) Copy the method content into the testcase methods.

  3. c.) Place your tests in the same package as the classes under test.

  4. d.) Can't do the testing for protected methods.

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

Protected methods can be tested by placing test classes in the same package as the classes under test (Option C), giving tests access to package-protected members. Reflection (Option A) is possible but not the recommended approach. Copying method content (Option B) defeats the purpose of testing. Option D is incorrect because protected methods are testable.