title: Should I unit test private methods?
body: <p>I know there is an ongoing debate in many posts [ <a href="https://stackoverflow.com/questions/34571/how-to-test-a-class-that-has-private-methods-fields-or-inner-classes">1</a>,<a href="https://stackoverflow.com/questions/7075938/making-a-private-method-public-to-unit-test-it-good-idea">2</a> ] in this sites on whether you should test private methods directly or indirectly.<br>
  What I can't seem to understand is how can I test a class where it has for example -<br>
  3 private methods that are approached by 10 different public methods.   </p>
  
  <p>Let's say the private methods sort its specific data structures or retrieve a value from them in a special way that only relates to the class (I am not going to create an inner class in every scenario).  </p>
  
  <p>Now, if I choose to test the private indirectly than I would have to re-write the tests for that private logic every time I test the public methods in order to <strong>fully</strong> test the method and keep the unit tests <strong>independent</strong>.<br>
  (It is not always possible to create a private method in the test class that tests the mutual code )<br>
  I will than have a to write repeating code and long test methods. </p>
  
  <p>So how is the indirect testing eligible as a standard?</p>