I have a method that returns an instance of a private class and I need access to its methods from a different package for unit testing. These classes live in the same file. It goes like this:
file: A.java
public class A{
B b;
public B getB(){
return b;
}
public setB(B b){
this->b = b;
}
}
class B{
C c;
public C getC(){
return c;
}
public setC(C c){
this->c = c;
}
}
class C{
public int getInt(){
return 1;
}
}
So... Basically the question is: are any of the methods in B or C reachable somehow? Am I obligated to place B and C in different files and make them public to accomplish that?