• Nagarjuna Sadhu
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hi All,
           I have a simple method that inserts record into account object through lightning component.My apex class method is as follows.
 
 @AuraEnabled
     public static Account saveAccount(account acc){
       insert acc;
       return acc;
     }
My test class for this is

@isTest
private class testClassExample {
    @isTest static void createAcc(){
        Account acc=new Account();
        acc.Name = 'Test Account';
        acc.Phone = '12345';
        acc.Account_Type__c = 'Insurance';
        try{
             insert acc;
        }catch(Exception e){
            system.debug(e);
        }
                  
        Account a = example.saveAccount(acc); 
        integer count=[select count() from account];
        system.assertEquals( 1,count);
    }
My Test coverage is 66% and return statement from saveAccount method is not covered for coverage,how to cover this return statement.
Any help is appreciated.

Thank you.
Hello All,

 While I am creating community through apex, Site.createExternalUser(u, accountId, password) is returning null

 Can anyone help me out?