Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (120 points)

Hello,

I have the following apex class and I need to write a test apex class for it. I started writing it but the code coverage is 0% . I am new into this and I don't know how to write it - can somebody help me ? 

APEX Class : 

public class GetAccount {

    

    @AuraEnabled

    public static List<Account> getAccountList(String currentId){

        List<Account> lstAcc = new List<Account>();  

        lstAcc = [Select id,Has_Code_Red_Cases__c,Has_Critical_Situation_Request_Cases__c from Account where id =: currentId];

        return lstAcc;

    }

}

TEST APEX CLASS:

@isTest 

public class GetAccountTest 

{

static testMethod void testMethod1() 

            {

                           Account acc = new Account();

                           acc.Name = 'Test Account';

                           insert acc;         

            }

}

Please log in to answer this question.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...