public void createExpectationFrom(Invocation invocation) {
expectation.setMethodMatcher(new MethodMatcher(invocation.getInvokedMethod()));
if (capturedParameterMatchers.isEmpty()) {
expectation.setParametersMatcher(new ParametersMatcher(invocation.getParametersAsArray()));
}
else {
checkParameterMatcherCount(invocation);
expectation.setParametersMatcher(new ParametersMatcher(capturedParameterMatchers));
}
dispatcher.stopCapturingExpectations();
}