Closed cropredyHelix closed 6 years ago
Yup, sounds reasonable. What would be really awesome is composable matchers, so we wouldn't have to deal with every permutation (List of SObjects with Name, List of SObjects with some field values, List of SObjects with Ids, or all of the Map and Set counterparts)...
But List
I guess we can close this, thanks to your PR. Thanks again!
The useful Matcher
sObjectWith
can't be used when attempting to verify the inputs to these:uow.registerNew(someListOfSobjects);
oruow.registerDirty(someListOfSobjects);
This is because the
sObjectWith
matcher is a singleton SObject and the argument passed to the uow methods is a list.What would be nice is a Matcher that would compare an expected SObject w/ field vals to see if any of the Sobjects passed to a
uow.registerXXX(someList)
had an sobject with those fieldValues.This could, I suppose, be extended to a Matcher that was a list of expected Sobjects w/ field values and would ensure that the list argument passed to uow.registerXXX had all of the expected Sobjects.
Basically, if the code under test is using the
uow.registerXXX(someList)
methods, there is no current way without resorting toArgumentCapture
to verify that the code under test called uow with the expected sobject(s). Or, put another way, since ApexMocks exists to support fflib (among other use cases), then supporting theuow.registerXXX(someList)
should be supported with a Matcher.