Friday 8 September 2023

ui button

@isTest

public class BatchJobControllerTest {


    static testMethod void testStartJob() {

        // Create test data if needed

        // For example, create a test record of OptyNextGen__c

        

        // Call the method being tested

        Test.startTest();

        String result = BatchJobController.startJob('RA', '100');

        Test.stopTest();


        // Verify the result

        System.assertEquals('Completed', result, 'Job did not start successfully');

    }


    static testMethod void testRefreshJob() {

        // Create test data if needed

        // For example, create a test record of AsyncApexJob

        

        // Call the method being tested

        Test.startTest();

        String result = BatchJobController.refreshJob('RA');

        Test.stopTest();


        // Verify the result

        System.assertEquals('Completed', result, 'Job status not retrieved correctly');

    }

}