ApexSensei

Drills Unit testing

Share setup and run as another user

@TestSetup runs once per class, and every test method sees its rows.

Your task

Finish seed() so it creates a fixture user on a standard Salesforce profile that can edit Tasks and does not have Modify All Data, plus an Account that user owns, and make logCallAs insert a Task as that user.

@IsTest
public class AS_CB16E9892B08_SharingTests {
    @TestSetup
    static void setup() {
        seed();
    }

    public static void seed() {
    }

    public static Id logCallAs(User fixture) {
        return null;
    }
}

Requirements

  1. setupCreatedTheUser should pass
  2. setupAccountBelongsToFixture should pass
  3. runAsCreatesTaskAsFixture should pass
  4. logCallSavesTheTask should pass

Sign in to open this drill