• profBrains
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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);
        }
    }
}

 
Hey guys trying to get comfortable with the Salesforce CLI, and went to deploy my code changes to my Dev Org but I keep getting the following error message. I checked out the link that they listed, but couldn't seem to figure out what issue was. I modified the JSON with the folder name that I'm trying to deploy, but still had no luck. 
 
Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn't in a package directory that's specified in your sfdx-project.json file. Add this location to your "packageDirectories" value, or deploy or retrieve a different file or directory. For details about sfdx-project.json, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_config.htm