I have an interface and its implementation which I can't change. Interface looks like this:
public Interface IHello{
// ... some method declarations
public static class IoH{
static IHello hello = new IHello.IoH.HelloImpl();
public IoH(){}
public static IHello getHello(){
return hello;
}
private static class HelloImpl implements IHello{
// .... constructor and methods....
}
}
}
I am also given an implementation of IHello interface, Hello (which is final class), which is just overriding the functions of IHello Interface and not doing anything else. That means it is not using any nested part of interface.
It is now used somewhere in the code as :
String string = IHello.IoH.getHello().getInfo(); // getInfo() is method of interface
I'm unit testing and I want to mock this IHello.IoH.getHello() or IHello.IoH.getHello().getInfo() with either MockImplementation of IHello interface and injecting some bean or using Mockito...
How can I do this?