How to write test case for below method

Custom Object : SAM_Request__c
Global Variable :crossChargeInfoSetFlag , samAdminFlag , samTeamFlag

boolean crossChargeInfoSetFlagMethod(SAM_Request__c requestRecord)
        if(requestRecord.txt_Request_Type_for_UI__c == 'Project' && (requestRecord.pkl_Status__c == SAM_Constants.QUOTE_APPROVED  || requestRecord.pkl_Status__c == SAM_Constants.CHARGING_REJECTED  || requestRecord.pkl_Status__c ==  SAM_Constants.AWAITING_CC_DETAILS_PENDINGWITHULSAM )){
             if(requestorFlag && !samAdminFlag && !samTeamFlag){
                crossChargeInfoSetFlag =false;
            }else if(financeTeamFlag && !samAdminFlag && !samTeamFlag){
                crossChargeInfoSetFlag = false;
            }else if((requestRecord.lkp_Assign_To__c !=null) && (samTeamFlag && requestRecord.lkp_Assign_To__c == userinfo.getuserid())){
                 crossChargeInfoSetFlag = true;
            }else if(samAdminFlag ){
                 crossChargeInfoSetFlag = true;
     return crossChargeInfoSetFlag;

Kindly help.

  1. First create record of SAM Request object.
  2. Populate txt_Request_Type_for_UI__c field with 'Project' value and set pkl_Status__c to either Approved or Rejected.
  3. Set flag value to satisfy first if condition. Invoke this method by passing above record.
  4. Repeat step 3, three more times by updatign flag value. or create 3 more different methods.
  • Can you please write code for this. – Pervez Mar 11 at 13:40
  • I've fixed your formatting for you, but being here 3 years, this is something I'd expect you to know how to do properly yourself. – Derek F Mar 11 at 13:51
  • I am new in Salesforce and got stuck in code coverage. If possible, please help me out. – Pervez Mar 11 at 14:15
  • @Sharique Please don't ask contributors to write your code for you. That's not what SFSE is for. Please see the Help Center for more about our format. – David Reed Mar 11 at 16:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.