commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Brisard <sebastien.bris...@m4x.org>
Subject [math] Using reflection to test private methods
Date Fri, 30 Nov 2012 07:06:09 GMT
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?

S├ębastien

[1] http://markmail.org/thread/5wafabqjbrswbmv7
[2] Gilles was -- quite rightly -- not too happy about that!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message