I have the following method outside the test method
private DynamicBuild getSkippedBuild() {
DynamicBuild build = mock(DynamicBuild.class);
when(build.i
If isSkipped()
is not a final
method, this problem probably indicates that you try to stub a method while stubbing of another method is in progress. It's not supported because Mockito relies on order of method invocations (when()
, etc) in its stubbing API.
I guess you have something like this in your test method:
when(...).thenReturn(getSkippedBuild());
If so, you need to rewrite it as follows:
DynamicBuild build = getSkippedBuild();
when(...).thenReturn(build);