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
Timothy SmithTimothy Smith 

Apex Testing (No Rows) Error

When a Vacation_Package__c is created and the Package_Type__c is equal to 'Select',  then set Sales_Company__c field to 'Upgrade Sales'.  I have a trigger and test class here is my error.


User-added image
User-added image

User-added image

SwethaSwetha (Salesforce Developers) 
HI Timothy,
Can you highlight line38 where an error is thrown?
ravi soniravi soni
you have to change something in your test class.
1. In your test class before insert newAcc above add one line Acc.Name = 'Upgrade Sales'.
2. in your Vacation_Package__c object it should be Vac.Package_Type__c = 'Select' and Vac.Package_Status__c = 'Active'

let me know if it helps you and don't forget to mark it as best answer and after above changes it's throwing error then you have to give your apex trigger and test class code.

Thank you

ravi soniravi soni
and you have to remove assertNotEquals line because now we have a account with Upgrade Sales.
ravi soniravi soni
hy Timothy,
we haven't get any response from your side. what is status our code is working or not.
please give us reply. if you are getting any error then please mention here. we'll try to resolve that and if your problam has solved then please mark it as best answer as your one best mark give us motivashion to helping others.

Thank you