0

I'm having a hard time writing up a test class for the following Apex class:

public class logger {
    @AuraEnabled
    public static void insertLog(string name, string id, string location, string data) {
        Log__c newLog;
        newLog = new Log__c();

        newLog.Name__c = name;
        newLog.Id__c = id;
        newLog.Location__c = location;
        newLog.Data__c = data;

        Insert newLog;
    }
}

This class will ultimately create a new record in the Log__c object with the strings that are passed on from the component using .setParams.

marked as duplicate by glls, Jayant Das, David Reed apex Mar 28 at 16:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Did you try to create a test class in Developer Console? Were you not able to create the test class or what the exact issue you are facing to start unit testing? – वरुण Mar 29 at 6:08