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
udayarangareddy mekalaudayarangareddy mekala 

Controller1

Hi
how to pass the test data for the IF conditions
try{
 if(val.contains('null')){
             val=null;
            }  
            }catch(NullPointerException E){
            }
            if(sr!=null&&val!=null){
           system.debug('***before executing doSearch***');
              doSearch();
}
For  above block please guide me how to pass the data depend on If condition.

Thanks&Regards
Rangareddy
Himanshu ParasharHimanshu Parashar
what is val ?
udayarangareddy mekalaudayarangareddy mekala
val is a variable
udayarangareddy mekalaudayarangareddy mekala
sr is also variable
 
Himanshu ParasharHimanshu Parashar
it would be great if you can post your apex class with your test class it will give better visibility what is the best answer in your case. because we don't know what variable you have used inside test class to set variable property in your apex class.
SRKSRK
As you are using val.contains, i assume val is either set or string and if you are checking for null and not for null as string , please dont put 'null' in single qotes

As Himanshu mentioned it will be good if you can post complite class so it will be easy to solve the problem