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
Meenu krishnaMeenu krishna 

how to write test class for the following code?

global with sharing class PriceAdjustmentHookImpl implements vlocity_cmt.VlocityOpenInterface
    global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options)  
            System.debug('____ PriceAdjustmentHookImpl' + methodName);
            if (methodName.equalsIgnoreCase('calculate.PreInvoke'))
                system.debug('invoked pre');
                List<OrderItem> itemList = (List<OrderItem>)vlocity_cmt.PricingPlanService.getFromPricingContext('LineItemList'); 
                system.debug(LoggingLevel.ERROR, 'itemList' + itemList);
                String  itemList1= '';//(String)itemMap.get('vlocity_cmt__Action__c');
                  System.debug('--- calculate.PreInvoke input: ' + JSON.serialize(input));
                  Map<String, Object> pricingVariableCodeToValueMap = (Map<String, Object>)input.get('pricingVariableMap');
                  Decimal REC_MNTH_STD_PRC = (Decimal)pricingVariableCodeToValueMap.get('REC_MNTH_STD_PRC');
                  pricingVariableCodeToValueMap.put('REC_MNTH_STD_PRC', 0.0); 
            else if (methodName.equalsIgnoreCase('calculate.PostInvoke'))
              system.debug('invoked post');
            return true;
        catch (Exception ex)
            System.debug('--- Exception: ' + ex.getMessage());
            System.debug('--- Stack Trace: ' + ex.getStackTraceString());
            throw ex;
Deepak GerianiDeepak Geriani
Please refer to the link ( ) on how to write the test and The Testing Best Practices (

If this info has helped you to resolve your issue please mark this answer as resolved.