I have some code like this:
class FooBar {
private String stateFoo;
public FooBar(String stateFoo){
this.stateFoo = stateFoo;
}
public void foo() {
FooInst f = FooInstFactory.createSomeFooInst(AnotherStaticFooConfig.getSomePath);
f.justCountMe();
}
}
My goal is to make sure that f.justCountMe()
was executed exactly once. I know how to do it in general with mockito.
What I don't know is how do I inject a mocked version of FooInst
into the foo
method? So that I can count the invocation?
Is it even possible to do so?