amoss
amoss copied to clipboard
Implement 'withField.setTo'
withFieldsSetTo is a very useful method for checking that an SObject has certain fields set to certain values, but it can be a little long-winded for checking a single value.
E.g.
.when( 'exampleMethod' )
.withParameterNamed( 'sObjectParameter' ).withFieldsSetTo( new Map<String,Object>{ 'IsPersonAccount' => true } )
It would be preferable to have a shorter-hand version of it that allows a single field value to be checked:
E.g.
.when( 'exampleMethod' )
.withParameterNamed( 'sObjectParameter' ).withField( 'IsPersonAccount' ).setTo( true )