JUnit testing private fields and methods
JUnit testing private fields and methods
Submitted by webmaster@testdriven.com (Links) on Thu, 02/09/2004 - 15:45.Using Java reflection, you can access and even alter private and protected fields of any class. You can effectively break encapsulation with this in a very naughty way. I guess we shouldn't go about using this in actual applications, but for unit testing our own classes, it will come in quite handy, and the code is very simple, just a few lines.
Author: Arne Vandamme
Posted: August 31, 2004
Author: Arne Vandamme
Posted: August 31, 2004
