apex-enterprise-patterns / fflib-apex-mocks

An Apex mocking framework for true unit testing in Salesforce, with Stub API support
BSD 3-Clause "New" or "Revised" License
423 stars 214 forks source link

Feature/better verification messages #96

Closed dfruddffdc closed 3 years ago

dfruddffdc commented 4 years ago

Adds better logging around expected and actual values to help diagnose match failures, and better descriptions of matchers. Addresses #58 and others.

Ported from FF internal repo. Tests all passing in my org.

dfruddffdc commented 3 years ago

Are there any circumstances where a user of the fflib-apex-mocks would be string matching on the Exception raised by verify() ?

It's an interesting point!

Technically, yes, but the exceptions thrown by verify are not really intended to be caught (except for unit tests for the framework itself). When you have matchers and fuzzy expected call counts, I can't think of a compelling reason not to just let the thrown exception cause a test failure.

daveespo commented 3 years ago

@dfruddffdc -- excellent contribution!

cropredyHelix commented 3 years ago

@dfruddffdc - I am so happy with this enhancement