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
roni shoreroni shore 

test class for page ref : Null pointer exception

Hi Guys- m trying to write test class for the below controller but getting a null pointer exception. please suggest.
controller
=======
Public Class Customer_Controller{
    
    ApexPages.StandardController controller;
     @TestVisible private final Case thisCase;

    public PB_Contact_Locale_Customer_Controller(ApexPages.StandardController controller) {
        this.controller = controller;
        this.thisCase = (Case)controller.getRecord();
    }
    public Boolean iscasenew {
        get {
            return (((String)thisCase.RecordTypeId).left(15) == Label.Case_RecordType);
        }
    }
    //Save method overriden
    public PageReference save(){
        try{
            controller.save();
            PageReference nextPage = new PageReference('/'+((Case)controller.getRecord()).Id);
            return nextPage;
            
        }
        catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,e.getMessage()));
        }
        return null;
    }
    //redirect to case create url
    public PageReference saveAndNew(){
        try{
            controller.save();
            return new PageReference(getRedirectURL());
        }
        catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,e.getMessage()));
        }
        return null;
    }
    
    //Cancel method overriden
    public PageReference cancel(){
        return new PageReference('/'+((Case)controller.getRecord()).Id);
    }
 @TestVisible private String getRedirectURL(){
​..
}}
Raj VakatiRaj Vakati
Share your complete controller and test class to see the issue ..