Testing Private/Protected Methods

3 views
Skip to first unread message

Michael Betancourt

unread,
Apr 10, 2013, 10:09:41 PM4/10/13
to stan...@googlegroups.com
What's the standard approach for testing internal methods? Is there anything to do besides create a derived class that exposes the method?

Bob Carpenter

unread,
Apr 10, 2013, 11:48:33 PM4/10/13
to stan...@googlegroups.com
For protected methods, you need to write mock extensions
to test them.

You don't need to test private methods. They're not part
of the public (or protected) API. They're "implementation
details". If you have independently testable functionality in private
methods, they should probably be made public or pulled out of
the class.

- Bob
Reply all
Reply to author
Forward
0 new messages