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
Thiago Barbosa 1Thiago Barbosa 1 

How to coverage this class test?

    public static Map<String, object> botaoExportarNovo(Map<String, object> btnExportar){
        Map<String, object> mapaObj = new Map<String, object>(); 
        CaseExpCsvController controller = new CaseExpCsvController();
            controller.lInicio = Date.valueOf((String)btnExportar.get('dataInicio'));
            controller.lfim = Date.valueOf((String)btnExportar.get('dataFinal'));
            controller.lAtualizar = Boolean.valueOf(btnExportar.get('lAtualizar'));
            controller.lFltTipoCaso = String.valueOf(btnExportar.get('lFltTipoCaso'));
            controller.lFltStatusCaso = String.valueOf(btnExportar.get('lFltStatusCaso'));
            controller.llCsvGerado = true;
            mapaObj.put('lSelect', controller.ldisplay);
        }catch(exception e){ 
        mapaObj.put('Errors', controller.errors);
        return mapaObj;

Amit Chaudhary 8Amit Chaudhary 8
You need to call above method like below in your test class.
Map<String, object> btnExportar = new Map<String, object> ();
btnExportar.put('dataInicio', new Object);
btnExportar.put('dataFinal', new Object);
btnExportar.put('lAtualizar', new Object);
btnExportar.put('lFltTipoCaso', new Object);
btnExportar.put('lFltStatusCaso', new Object);

CLASSNAME.botaoExportarNovo(btnExportar );

Let us know if this will help you