Unit test helper methods?
Posted
by Aly
on Stack Overflow
See other posts from Stack Overflow
or by Aly
Published on 2009-12-07T17:02:02Z
Indexed on
2010/04/26
21:43 UTC
Read the original article
Hit count: 226
Hi, I have classes which prviously had massive methods so i subdivided the work of this method into 'helper' methods. These helper methods are declared private to enforce encapsulation - however I want to unit test the big public methods, is it good to unit test the helper methods too as if one of them fail the public method that calls it will also fail - but this way we can identify why it failed. Also in order to test these using a mock object I would need to change their visibility from private to protected, is this desirable?
© Stack Overflow or respective owner