QuestionQ59Verified/TestingCopy linkReport a problemAsk AstroTutorSave questionWhich two statements correctly explain why Mock objects are necessary when writing test classes?Choose twoAMock can also be used on the classes that extend the batchable interface to bypass the batch jobs.BUsing a Mock allows the test class to bypass the dependencies of other objects, methods, state, or behaviors. Therefore, the developer has total control of his own code.CA Mock is needed whenever the code makes an HTTP callout.DSome methods are invoking long running processes, using Mock is a shortcut of bypassing the long executions.Show AnswerAnswerExplanationMocks isolate the code being tested by substituting controlled behavior for dependent objects, methods, state, or external services. Apex tests that execute HTTP callout code must provide a mock response rather than make an actual external request.Learn moreTesting Apex Callouts Using HttpCalloutMockWrite Tests for an Extension ProviderShow comments0Show commentsCommunity DiscussionNo comments yet. Be the first to start the discussion!
Community Discussion