• jacob frey
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi and thanks in advance for your help.  I wrote this test and can't figure out why I can't get any coverage.  Seems so simple.

public with sharing class AccountStatus
{

 @AuraEnabled

    public static Account getAccount(Id accountId)

    {

        //Query fields from Parent record to prepopulate New RTO

        return [SELECT Id, Name, Account_Status__c, Bill_To_DUNs_Number__c,  

                BillingCountry,BillingStreet,BillingCity,BillingState,BillingPostalCode,

                Billing_County__c,BillingStateCode,Legal_Entity_Name__c,Type__c,Account_Record_ID__c,

                Current_Brand__c

                FROM Account where id = :accountId];    

    }

}


Test class

@isTest
private class AccountStatusTest

{

   

    static testMethod void getAccount()

    {

        Account a = new Account();

        a.name='Test';

        a.phone='12345';        

        a.Account_Status__c = 'Active Account';

        a.Bill_To_DUNs_Number__c = '1234567890';

        a.BillingCountry = 'United States';

        a.BillingStreet = 'Main Street';

        a.BillingCity = 'Dallas';

        a.BillingState = 'Texas';

        a.BillingPostalCode = '76543';

        a.Billing_County__c = 'Blackland';

        a.BillingStateCode = 'TX';

        a.Legal_Entity_Name__c = 'TestParent';

        a.Type__c = 'Retail Outlet';

       // a.Account_Record_ID__c = '0120W000001USkRQAW';

        a.Current_Brand__c = 'Sunoco';

        insert a;

       

        Account a2=[SELECT Id, Name, Account_Status__c, Bill_To_DUNs_Number__c,  

                BillingCountry,BillingStreet,BillingCity,BillingState,BillingPostalCode,

                Billing_County__c,BillingStateCode,Legal_Entity_Name__c,Type__c,Account_Record_ID__c,

                Current_Brand__c

                FROM Account where id = :a.id];

        System.assert(a2!=null);        

    }    

}

Thank You,
Eric