I have class like
public class Myclass{
public boolean processePersonData(){
private Person p;
boolean flag=true;
if(flag){
p= new Person("john",1);
}
else{
p= new Person("adam",2);
}
//do sth with p
}
}
How can I mock the variable p, I googled a lot but did not get the answer. can this be done with mockito. I dont want any changes in the code .