+ Start a Discussion
Ravikant kediaRavikant kedia 

Problem in test class.

How to cover below test class code.
    String iso = userInfo.getDefaultCurrency();
        String symbol = null;
        if(iso == 'EUR'){symbol='€'; }
        else if (iso=='ALL') { symbol='Lek'; } 
        else if (iso=='USD') { symbol='$'; } 
        else if (iso=='ARS') { symbol='$'; } 
        else if (iso=='AWG') { symbol='ƒ'; } 
        else if (iso=='AUD') { symbol='$'; } 
        else if (iso=='BSD') { symbol='$'; } 
        else if (iso=='BBD') { symbol='$'; }
        return symbol;
PratikPratik (Salesforce Developers) 
Hi Ravikant,

Here are the gudelines:

You class has alsmost all the Conditional statements. You will need to cover these  If part as well as else part.
In your test class insert a record and then update it's value to all the iso codes you have mentioned in above code and one more value which is outside the above iso codes to cover the last else part.

This should cover your above code.

You can also refer to: