Here is what I want to achieve.
public class A {
protected final Config config;
protected final Connection connection;
public A(Config config) {
this.config = config;
this.connection = new Connection("a", "b");
}
public void someMethod() {
}
}
When I try to test some underlying methods for the class A, I would want to mock the connection object creation. How can I do that, I have tried all possible ways but didn't find any luck.