I am writing unit testing using JUNIT + Mockito to test a method like:
public someObject methodUnderTest(){
SomeObject obj = SomeAbstractClass.someMethod();
if(obj!=null){
obj.someOtherMethod();
}
return someThing;
}
And I would like to make fun of the call abstract Class "SomeAbstractClass"mentioned in the previous code snippet so that I can test the call on "obj", for example:
verify(SomeAbstractClass).someMethod();
verify(obj).someOtherMethod();
I tried using mockito functions such as: Mockito.CALLS_REAL_METHODS Mockito.RETURNS_MOCKS
but they do not work due to dependencies not available to SomeAbstractClass.
Note:
1) SomeObject is an interface.
2) I need a technique for testing a piece of code. I am forced to use the above code fragment and cannot change the code fragment.