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
DeveloperDeveloper 

Please write test class....help me.....

Test class ............please write.............
 public class NewRoadButtonController 
{
         public id currentRecordId{get;set;}
         public event ev{get;set;}
         public Boolean Car{get;set;}
         Private List<Event> eventList;
         public NewRoadButtonController(ApexPages.StandardController controller)
            {
               this.currentRecordId=controller.getRecord().Id;
            }

        public pagereference newRoadSafetyPage()
            {
                eventList=[select Travelling_by_Car__c,id,Subject,StartDateTime,Today_Date__c from Event where id=:ApexPages.currentPage().getParameters().get('id') LIMIT 1];
                if(eventList.size()!=0)
                {
                    if(eventList[0].Travelling_by_Car__c)
                    {
                        Road_Safety__c objrs = new Road_Safety__c();
                        objrs.Originating_Event_ID__c=eventList[0].id;
                        objrs.Originating_Event_Name__c=eventList[0].Subject;
                        objrs.Road_Safety_Check_Name__c=eventList[0].Subject+'-'+eventList[0].Today_Date__c;
                        objrs.IsChecked__c=true;
                        insert objrs;
        
                        Event eventOld = new Event();
                        eventOld.Id = ApexPages.currentPage().getParameters().get('id');
                        eventOld.Road_Safety_Check__c = objrs.Id;
                        Update eventOld; 
             
                        PageReference requestPage = new pagereference('/'+ objrs.id + '/e');
                        return requestPage;
                    }
                    else
                    {
                        PageReference pa=new pageReference('/apex/ErrorPage');
                        return pa;
                    }
                 
               }
               return null;
            }
}

============================================

global class RoadsafetyEventNotificationBatchSchedule implements Schedulable 
{
        global void execute(SchedulableContext sc) 
    {
        RoadsafetyEventNotificationBatch batch=new RoadsafetyEventNotificationBatch();
        Database.executeBatch(batch);  
    }
    public static void scheduler()
    {
      RoadsafetyEventNotificationBatchSchedule m = new RoadsafetyEventNotificationBatchSchedule();
      String sch ='0 0 * * * ?';
      String jobID1 = system.schedule('Push Notification Job1', sch, m);
      String sch1 ='0 5 * * * ?';
      String jobID2 = system.schedule('Push Notification Job2', sch1, m);
      String sch2 ='0 10 * * * ?';
      String jobID3 = system.schedule('Push Notification Job3', sch2, m);
      String sch3 ='0 15 * * * ?';
      String jobID4 = system.schedule('Push Notification Job4', sch3, m);
      String sch4 ='0 20 * * * ?';
      String jobID5 = system.schedule('Push Notification Job5', sch4, m);
      String sch5 ='0 25 * * * ?';
      String jobID6 = system.schedule('Push Notification Job6', sch5, m);
      String sch6 ='0 30 * * * ?';
      String jobID7 = system.schedule('Push Notification Job7', sch6, m);
      String sch7 ='0 35 * * * ?';
      String jobID8 = system.schedule('Push Notification Job8', sch7, m);
      String sch8 ='0 40 * * * ?';
      String jobID9 = system.schedule('Push Notification Job9', sch8, m);
      String sch9 ='0 45 * * * ?';
      String jobID10 = system.schedule('Push Notification Job10', sch9, m);
      String sch10 ='0 50 * * * ?';
      String jobID11 = system.schedule('Push Notification Job11', sch10, m);
      String sch11 ='0 55 * * * ?';
      String jobID12 = system.schedule('Push Notification Job12', sch11, m);
    
    }




Thanks in advance
Best Answer chosen by Developer
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Gopal,

May I request you to please check for Test Class Generator App from APP Exchange.Please refer the below link. I hope it will be helpful.

Please mark it as best answer if the information is informative.

Best Regards
Rahul Kumar​