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
dselatdselat 

Apex test class for code coverage

Hello.

 

I am new to apex class. Can someone please help me come up with a test class for the below apex code?

 

 

global with Sharing class MarqueeDashboardController {

private User user;

private String MarqueeUrl()
{
return 'http://ashapt59vs/';
}

public String getQueueDashboardUrl()
{
user = [SELECT id, email, username, usertype, profileid, Forecast_Rollup__c, SubArea__c
                FROM User
                WHERE id = :UserInfo.getUserId()];
        // check users profile to be able to access this page
        if(user.Forecast_Rollup__c == 'I. GovCon Inside Sales') {
            return MarqueeUrl() + 'SalesforceDashboardSales_GovConD.html';
            }
        else if(user.Forecast_Rollup__c == 'Z. PDG') {
            return MarqueeUrl() + 'SalesforceDashboardSales_GovConT.html';
            }
        else if(user.Forecast_Rollup__c == 'N. Account Management') {
            return MarqueeUrl() + 'SalesforceDashboardSales_GovConISAM.html';
            }
        else if(user.Forecast_Rollup__c == 'Z. PS Inside Sales') {
            return MarqueeUrl() + 'SalesforceDashboardSales_PSIS.html';
            }
        else {
            return MarqueeUrl() + 'SalesforceDashboard.html';
        }
    return null;
    }
}

 

Thanks.