On Fri, Nov 30, 2012 at 8:06 AM, Sébastien Brisard <
sebastien.bris...@m4x.org> wrote:

> Hi,
> I've already posted the same question in another thread [1], but I thought
> having a dedicated thread would increase its visibility.
>
> Here is my problem. The new implementation of Beta.logBeta(double, double)
> I'm currently working on relies on several private methods through a rather
> complex branching.
> Due to this complicated branching, I find it much safer to have direct
> tests for these private methods, instead of relying on the tests of
> Beta.logBeta to validate these methods.
> Therefore, in order to preserve encapsulation (these private methods should
> really remain private, and not package private, as I previously did [2]), I
> propose to use reflection in the unit tests to access these private
> methods. I've tested this option locally, it seems to me that it is a
> viable option.
>
> What do you think about this compromise?
>

imho, this is perfectly valid in such a specific case, and I had to do the
same in other projects occasionally.

Thomas

Reply via email to