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
Jonathan Wolff 7Jonathan Wolff 7 

Test class for custom Event Component

Hello,
I build a custom Event component that I would like to convert into Liveground. I know, that I need to build a test class for my apex class.
The component just displays the subject, activityDate, Start and EndDate of an event. Could you give me a code for the test class.
The apex class code is this:

public with sharing class EventController {
  

    @AuraEnabled
  public static List<Event> loadEvents(Id recordId){
      string userId = UserInfo.getUserId();
    return[SELECT Subject, ActivityDate, StartDateTime, EndDateTime FROM Event WHERE WhatId=:recordId And ActivityDate>= TODAY 
           AND ActivityDate  < Next_N_Days:1 AND OwnerId=:userId ];
  }
    @AuraEnabled
  public static List<Event> loadEvents2(Id recordId){
      string userId = UserInfo.getUserId();
      Date tomorrowDate = Date.today().addDays(1);
    Date dayAfterTomorrow = tomorrowDate.addDays(1);
    return[SELECT Subject, ActivityDate, StartDateTime, EndDateTime FROM Event WHERE WhatId=:recordId And ActivityDate>= :tomorrowDate AND ActivityDate  < :dayAfterTomorrow AND OwnerId=:userId ];
  }

    @AuraEnabled
  public static List<Event> loadEvents3(Id recordId){
      string userId = UserInfo.getUserId();
      Date tomorrowDate = Date.today().addDays(1);
      Date dayAfterTomorrow = tomorrowDate.addDays(1);
      Date twodaysAfterTomorrow = tomorrowDate.addDays(2);
    return[SELECT Subject, ActivityDate, StartDateTime, EndDateTime FROM Event WHERE WhatId=:recordId And ActivityDate>= :dayAfterTomorrow AND ActivityDate  < :twodaysAfterTomorrow AND OwnerId=:userId ];
  }
    
}