Consider the following code snippet:
Java
01 public with sharing class AccountsController{
03 @AuraEnabled
04 public List
05 return [Select Id, Name, Industry FROM Account];
06 }
08 }
As part of the deployment cycle, a developer creates the following test class:
Java
@isTest
private class AccountsController_Test{
@TestSetup
private static void makeData(){
User user1 = [Select Id FROM User WHERE Profile.Name = 'System Administrator' ... LIMIT 1];
User user2 = [Select Id FROM User WHERE Profile.Name = 'Standard User' ... LIMIT 1];
TestUtils.insertAccounts(10,user1.Id);
TestUtils.insertAccounts(20,user2.Id);
}
@isTest
private static void testGetAllAccounts(){
// Query the Standard User into memory
List
System.assertEquals(20,result.size());
}
}
When the test class runs, the assertion fails. Which change should the developer implement in the Apex test method to ensure the test method executes successfully?
Submit