If I Have:
public abstract class A {
private Object target; // <- **IMPORTANT**
protected Blah blah // ... Not directly relevant to the question,
protected Blah blah2 // they are just a potential reason to extend
// test class ...?
public int func (){
int hello = Integer.parseInt(target.Fields.want2Change);
return hello;
}
}
I want to test Class A. Because It is abstract, I extend it with lets say Class ATest. There are other Fields but they are protected and this is reasonable.
My question is FROM THE CHILD CLASS, how can I access a parent PRIVATE field like target.
I am using a mix of mocking (Mockito), and Reflection.
I have also tried just using reflection and NOT extending the class.