This question arise while trying to write test cases. Foo is a class within the framework library which I dont have source access to.
public class Foo{ pub
If the variable returned by getX() is not final you can use the technique explained in What’s the best way of unit testing private methods? for changing the value of the private variable through Reflection.
getX()
final
private
Reflection