You need to sign in to do that
Don't have an account?
newbiewithapex
How do I write test class for a method that get events?
I have a method to get events and I am trying to figure out how to write test class for that method. Please check out the method below and let me know. Thanks!
@AuraEnabled /* Method to get events */ public static Event mGetEvent(string recordId) { Event evt = [SELECT Type, Subject, IsAllDayEvent, RecurrenceActivityId, Frequency_Details__c, Location, OwnerId, ActivityDate, Description, DurationInMinutes, RecordTypeId, RecordType.Name, EndDateTime, EventSubtype, WhoId, isRecurrence, IsPrivate, WhatId, ShowAs, StartDateTime, SC_Responsible__c, ROC_Primary_Deployment__c, RecurrenceType ,RecurrenceInterval ,Automatically_Extend_Recurring_Event__c,RecurrenceMonthOfYear,RecurrenceInstance,RecurrenceDayOfWeekMask ,RecurrenceDayOfMonth, FFC_Deployment_Type__c,Inside_Support__c, ROC_Comments_for_Other_Deployment__c, Reminder_Duration_LEX__c, Additional_Attendee_Type__c, Follow_Up_Required__c, FFC_Comments_for_Other__c FROM Event where id=: recordId LIMIT 1]; if(evt.IsAllDayEvent) { evt.StartDateTime = DateTime.newInstance(evt.StartDateTime.yearGMT(), evt.StartDateTime.monthGMT(), evt.StartDateTime.dayGMT(), 12, 0, 0); evt.EndDateTime = DateTime.newInstance(evt.EndDateTime.yearGMT(), evt.EndDateTime.monthGmt(), evt.EndDateTime.dayGMT(), 13, 0, 0); } return evt; }