You need to sign in to do that
Don't have an account?
Jay Gatsby
Can anyone suggest how to write test class for method returning Map<String,Object> ?
I have below sample method
@testVisible
private static Map<String,Object> getSampleMap(List<Object> sampleList){
Map<String,Object> sampleMap = new Map<String,Object>();
if(sampleList!= null && sampleList.size()>0 ){
for(Object obj : sampleList){
sampleMap.put(obj.field1,obj);
}
}
return sampleMap ;
}
@testVisible
private static Map<String,Object> getSampleMap(List<Object> sampleList){
Map<String,Object> sampleMap = new Map<String,Object>();
if(sampleList!= null && sampleList.size()>0 ){
for(Object obj : sampleList){
sampleMap.put(obj.field1,obj);
}
}
return sampleMap ;
}
For this method "getSampleMap", you need to preprae some test data in your test class and then invoke this metod from your test class (pass the corresponding parameter).
Thanks.