我认为这需要更多的定制工作。
verify(row, new LastCall()).saveToDatabase();
然后
public class LastCall implements VerificationMode { public void verify(VerificationData data) { List<Invocation> invocations = data.getAllInvocations(); InvocationMatcher matcher = data.getWanted(); Invocation invocation = invocations.get(invocations.size() - 1); if (!matcher.matches(invocation)) throw new MockitoException("..."); }}
上一个答案:
你是对的。verifyNoMoreInteractions是您所需要的。
verify(row).setSomething(value);verify(row).setSomethingElse(anotherValue);verify(row).editABunchMoreStuff();verify(row).saveToDatabase();verifyNoMoreInteractions(row);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)