PDII · Question #17
global with sharing class MyRemoter { public String accountName { get; set; } public static Account account { get; set; } public AccountRemoter() {} @RemoteAction global static Account getAccount(Stri
Sign in or unlock PDII to reveal the answer and full explanation for question #17. The question stem and answer options stay visible for context.
Question
global with sharing class MyRemoter { public String accountName { get; set; } public static Account account { get; set; } public AccountRemoter() {} @RemoteAction global static Account getAccount(String accountName) { account = [SELECT Id, Name, NumberOfEmployees FROM Account WHERE Name = :accountName]; return account; } } Consider the Apex class above that defines a RemoteAction used on a Visualforce search page. Which code snippet will assert that the remote action returned the correct Account?
Options
- AAccount a = controller.getAccount('TestAccount'); System.assertEquals( 'TestAccount', a.Name );
- BMyRemoter remote = new MyRemoter(); Account a = remote.getAccount('TestAccount');
- CMyRemoter remote = new MyRemoter('TestAccount'); Account a = remote.getAccount ();
- DAccount a = MyRemoter.getAccount('TestAccount'); System.assertEquals( 'TestAccount',
Unlock PDII to see the answer
You've previewed enough free PDII questions. Unlock PDII for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.