Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 23, 2023 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arun12209/27315ce12961bedc511b33bcdae284e2 to your computer and use it in GitHub Desktop.
Save arun12209/27315ce12961bedc511b33bcdae284e2 to your computer and use it in GitHub Desktop.
@isTest
public class MyTestClass {
static testMethod void testMyMethod() {
List<Account> accounts = new List<Account>{
new Account(Name='Test Account 1'),
new Account(Name='Test Account 2')
};
insert accounts;
Test.setFixedSearchResults(accounts);
List<Account> results = [FIND 'Test Account*' IN ALL FIELDS RETURNING Account(Name)];
System.assertEquals(2, results.size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment