I supposed to test a project designed equivalent to something like this :
public class A(){
public static void init() {
M.m();
//some code
}
}
public class M(){
public static void m() {
//some code
}
}
I need to test the method init()
in class A()
alone. Therefor I must make a Mock or a stub for M.m()
with the same signature of the original one. But without modifying anything in the 2 classes as it's not allowed . How can I make the init()
call the stub and ignore the original method in this case where both methods are static ?