I tend to follow the advice of Dave Thomas and Andy Hunt in their book Pragmatic Unit Testing:
In general, you don't want to break any encapsulation for the sake of
testing (or as Mom used to say, "don't expose your privates!"). Most
of the time, you should be able to test a class by exercising its
public methods. If there is significant functionality that is hidden
behind private or protected access, that might be a warning sign that
there's another class in there struggling to get out.
But sometimes I can't stop myself from testing private methods because it gives me that sense of reassurance that I'm building a completely robust program.