Skip to content

Commit

Permalink
Added a lot of tests for ortoo_Criteria
Browse files Browse the repository at this point in the history
Switched fflib_SObjects2 over to use interface for criteria, allowing use of ortoo_Criteria
Fixed documentation errors on ortoo_Criteria
  • Loading branch information
rob-baillie-ortoo committed Feb 16, 2022
1 parent 66303ff commit 746fc54
Show file tree
Hide file tree
Showing 3 changed files with 520 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public virtual class fflib_SObjects2
*
* @return Return the SObject records contained in the domain matching the criteria
*/
public virtual List<SObject> getRecords(fflib_Criteria criteria)
public virtual List<SObject> getRecords(fflib_Criteria.Evaluator criteria)
{
List<SObject> result = new List<SObject>();
for (SObject record : getRecords())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@ public inherited sharing virtual class ortoo_Criteria implements ISearchCriteria
{
fflib_Criteria criteria;

// TODO: write tests for SOQL generation of:
// orCriteria
// andCriteria
// andOrCriteria
// andAndCriteria
// formulaCriteria
//
// equalTo
// notEqualTo
// greaterOrEqualTo
// greaterThan
// lessOrEqualTo
// lessThan
//
// TODO: consider a test for filtering of records?
// TODO: change SObjects2 to allow ortoo_Criteria - maybe define an interface instead

public ortoo_Criteria()
{
criteria = new fflib_Criteria();
Expand Down Expand Up @@ -106,7 +89,7 @@ public inherited sharing virtual class ortoo_Criteria implements ISearchCriteria
* .equalTo(Account.AccountNumber, '0002'))
*
* Evaluates:
* Account.Name = 'Example' AND (Account.AccountNumber = '0001' OR Account.AccountNumber = '0002')
* Name = 'Example' AND (AccountNumber = '0001' OR AccountNumber = '0002')
*/
public ortoo_Criteria addOrCriteria( ortoo_Criteria subCriteria )
{
Expand Down Expand Up @@ -155,10 +138,10 @@ public inherited sharing virtual class ortoo_Criteria implements ISearchCriteria
* .formulaCriteria('(1 OR 2) AND 3')
* .equalTo(Account.AccountNumber, '0001')
* .equalTo(Account.AccountNumber, '0002')
* .equalTo(Account.ShippingCountry, 'USA'))
* .equalTo(Account.ShippingCountry, 'USA')
*
* Evaluates:
* (AccountNumber = '0001' OR AccountNumber = '0001') AND ShippingCountry = 'USA'
* (AccountNumber = '0001' OR AccountNumber = '0002') AND ShippingCountry = 'USA'
*/
public ortoo_Criteria formulaCriteria( String formula )
{
Expand Down
Loading

0 comments on commit 746fc54

Please sign in to comment.