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

public class logger {
    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.

  • 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 '19 at 6:08