+ Start a Discussion
NNRNNR 

Test Class for bellow method..

HI FNds can you help me out.........

 public string[] getclientLastName(){
        String temp;
        if((acc[0].Alias_Client_First_Name__c != Null)&&(acc[0].Alias_Client_Last_Name__c != Null)){
            temp = acc[0].Alias_Client_Last_Name__c;
        }
        else{
            temp = acc[0].LastName__c;
        }
        
        system.debug('----------'+temp);
        clientLastName = new string[30];
        if(temp == Null){
            for(integer i=0 ; i< 30; i++){
                clientLastName [i] = ' ';
            }
            return clientLastName;
        }
        integer totallenngth = 30;
        integer realLength = temp.length();
        if( realLength > 30){
            realLength = 30;
        }
        integer remaingLength = 30 - realLength;
        
        temp = temp.toUpperCase();
        for(integer i=0;i<realLength ;i++){
            clientLastName[i] = temp.substring(i,i+1);
            system.debug('----'+i);
        }
        for(integer i=realLength;i< totallenngth ;i++){
            clientLastName[i] = ' ';

        }
        return clientLastName;
    }
   

Thanks for in advanced
SonamSonam (Salesforce Developers) 
I understand this method is for checking the alias first/last name of the client field on the account object(assuming account coz of the variable acc)

You need to first create an account with Client Name(first name and last name) and try to make the record pass the IF statements so you can test the conditional lines.