My_Test_Repo/force-app/main/default/classes/AccountSearchControllerTest...

19 lines
818 B
OpenEdge ABL

@isTest
public class AccountSearchControllerTest {
@isTest static void testSearchAccounts() {
// Prepare test data
Account testAccount1 = new Account(Name = 'Test Account 1');
Account testAccount2 = new Account(Name = 'Test Account 2');
insert new List<Account>{ testAccount1, testAccount2 };
// Call the method to test
Test.startTest();
List<Account> accounts = AccountSearchController.searchAccounts('Test');
Test.stopTest();
// Verify the results
System.assertEquals(2, accounts.size(), 'Expected to find 2 accounts');
System.assertEquals(testAccount1.Id, accounts[0].Id, 'The first account ID does not match');
System.assertEquals(testAccount2.Id, accounts[1].Id, 'The second account ID does not match');
}
}