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
RaffusRaffus 

How to write a test class for following method

public void onLoad() {
        Map<String, String> mapParams = Apexpages.currentPage().getParameters();
       
        if (!mapParams.isEmpty()){
            if (mapParams.containsKey('emailid')) {
                system.debug('inside decrypt---');
                String emailidApp = FSLCryptoHelper.getInstance().decryptOmni(mapParams.get('emailid'));
                emailid = emailidApp.toLowercase();
                system.debug('inside decrypt---'+emailid);
            }
            if (mapParams.containsKey('empid')) {
                system.debug('inside decrypt empid---');
                empid = FSLCryptoHelper.getInstance().decryptOmni(mapParams.get('empid'));
                system.debug('inside decrypt emailid---'+emailid);
            }
            if (mapParams.containsKey('jwt-token')) {
                system.debug('inside decrypt jwttoken---');
                jwttoken = FSLCryptoHelper.getInstance().decryptOmni(mapParams.get('jwt-token'));
                system.debug('inside decrypt jwttoken---'+jwttoken);
            }
           
        }


My test class
 
 @isTest
    static void onLoadTest(){
            PageReference testPage = Page.OmniAppPage;
            Test.setCurrentPage(testPage);
            testPage.getParameters().put('emailid', 'test@test.com');
            testPage.getParameters().put('empid', '1233');
            testPage.getParameters().put('jwt-token', '1233');
           
            OmniAppController oac = new OmniAppController();        
            oac.onLoad();
    }
FSLCryptoHelper.decryptOmni method
 
public String decryptOmni(String dataToDecrypt) {
    	System.debug('VV Before dataToDecrypt -->'+dataToDecrypt);
        String decryptedData = '';
        if (dataToDecrypt != null) {
            dataToDecrypt = dataToDecrypt.replaceAll(' ', '+');
            Blob data = EncodingUtil.convertFromHex(dataToDecrypt);
            System.debug('VV before dataToDecrypt -->'+dataToDecrypt);
            Blob decryptedBlob = Crypto.decrypt(ALGORITHM_AES256, ONEAPP_KEY, ONEAPP_IV, data);
            System.debug('VV After decryptedBlob -->'+decryptedBlob);
            decryptedData = decryptedBlob.toString();
            System.debug('VV After decryptedData -->'+decryptedData);
        }
        return decryptedData;
    }
Getting this error - 
"System.InvalidParameterValueException: input string must be an even number of characters long, but was 13"

On line - Blob data = EncodingUtil.convertFromHex(dataToDecrypt);