def message_received(sym, *args, &block)
expectation = find_matching_expectation(sym, *args)
stub = find_matching_method_stub(sym, *args)
if (stub && expectation && expectation.called_max_times?) || (stub && !expectation)
if expectation = find_almost_matching_expectation(sym, *args)
expectation.advise(args, block) unless expectation.expected_messages_received?
end
stub.invoke(args, block)
elsif expectation
expectation.invoke(args, block)
elsif expectation = find_almost_matching_expectation(sym, *args)
expectation.advise(args, block) if null_object? unless expectation.expected_messages_received?
raise_unexpected_message_args_error(expectation, *args) unless (has_negative_expectation?(sym) or null_object?)
else
@target.__send__ :method_missing, sym, *args, &block
end
end