That's fine. I think raw use of reflection might make the tests pretty complicated, but the idea is reasonable.
Jmockit allows mocking of static methods (I have used it to mock System.nanoTime(), for instance). By using a partial mock class, you can gain access to private methods as well. On Thu, Nov 29, 2012 at 10:59 PM, Sébastien Brisard < sebastien.bris...@m4x.org> wrote: > Does anyone oppose the usage of reflection in unit testing to access > private methods? > I personnally think it is a good compromise between encapsulation and > comprehensive testing. >