function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
profBrainsprofBrains 

Apex Unit Test

Hi Guys, I am new to apex development and my first task is write an apex unit test for this class. I have no Idea how to approach it. please help.
public class CaseUpdateAsync implements Queueable, Database.AllowsCallouts {

    private Map<Id, Case> caseUpdateMap { get;set; }
    private Integer numberOfUpdateAttempts { get;set; }

    public CaseUpdateAsync(List<Case> caseUpdateList) {
        this.caseUpdateMap = new Map<Id, Case>(caseUpdateList);
        this.numberOfUpdateAttempts = 1;
    }

    public CaseUpdateAsync(List<Case> caseUpdateList, Integer numberOfUpdateAttempts) {
        this.caseUpdateMap = new Map<Id, Case>(caseUpdateList);
        this.numberOfUpdateAttempts = numberOfUpdateAttempts;
    }

    public void execute(QueueableContext context) {
        if (this.numberOfUpdateAttempts > 1) {
            List<Case> reattemptUpdateCaseList = new List<Case>();
            List<Database.SaveResult> srList = Database.update(this.caseUpdateMap.values(), false);
            for (Database.SaveResult sr : srList) {
                if (!sr.isSuccess()) {
                    reattemptUpdateCaseList.add(this.caseUpdateMap.get(sr.getId()));
                }
            }
            if (!reattemptUpdateCaseList.isEmpty() && !Test.isRunningTest()) {
                System.enqueueJob(new CaseUpdateAsync(reattemptUpdateCaseList, this.numberOfUpdateAttempts - 1));
            }
        }
        else {
            Database.update(this.caseUpdateMap.values(), true);
        }
    }
}