You need to sign in to do that
Don't have an account?
Laurie Drew
Help with a test class
Hi there, I am new to apex and hoping someone can point me in the right direction with my test class, it shows coverage for the 'insert' but not for the return portion. Can someone tell me what more I need to add?
Here is my function:
public static id SaveUpdateAccountProfileFormDetails(Account accountForm ){
insert accountForm;
return accountForm.id;
My test class so far:
static testmethod void SaveUpdateAccountProfileFormDetailsTest()
{
Account accountForm = new Account(Name='TestAccount',billingStreet='123 Test Street',billingCity='Springfield',billingpostalcode='12345',billingcountry='US',FEIN__c='123456',BusinessOrganization__c='LLC');
test.startTest();
SaveUpdateAccountDetails.SaveUpdateAccountProfileFormDetails(accountForm);
test.stopTest();
}
Thank you in advance for any assistance you can provide!
Here is my function:
public static id SaveUpdateAccountProfileFormDetails(Account accountForm ){
insert accountForm;
return accountForm.id;
My test class so far:
static testmethod void SaveUpdateAccountProfileFormDetailsTest()
{
Account accountForm = new Account(Name='TestAccount',billingStreet='123 Test Street',billingCity='Springfield',billingpostalcode='12345',billingcountry='US',FEIN__c='123456',BusinessOrganization__c='LLC');
test.startTest();
SaveUpdateAccountDetails.SaveUpdateAccountProfileFormDetails(accountForm);
test.stopTest();
}
Thank you in advance for any assistance you can provide!
- I read your problem and implemented it in my Org and it is working fine.
- Please use the below code (Solved) I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
All Answers
- I read your problem and implemented it in my Org and it is working fine.
- Please use the below code (Solved) I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.
Try below code it covers 100% code:
//Class code
//Test Class I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi