You need to sign in to do that
Don't have an account?
Matthew Rogers
How would I write a test class for this very simple Custom controller?
public class OpportunityController { public List<Opportunity> opp {get;set;} public OpportunityController() { opp = [SELECT Id, Name, CreatedDate, StageName, Placement__c, LDN_Company__c, Description, Job_Title__c, CloseDate, NextStep, Salary__c, Future_Prospects__c, Duration__c, Training_Delivery_Site__c, Qualification_taken__c, Entry_Requirements__c, Key_Responsibilities__c, Skills_Required__c, Account.Name, Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM Opportunity WHERE (StageName = '1 - Qualifying' or StageName = '2 - Booked for CK' or StageName = '3 - Live' or StageName = '4 - Work Trial') AND (Placement__c = 'New Apprentice')]; } }
I can't figure out how to approach it for a custom and not standard controller
Thank you
Greetings to you!
Please try the below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Here is the dummy data which I am providing in this test class, please fill the opportunity custom fields values as per your requirement. Kindly share with me whatever error and exception you are getting:
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 the below code it will help you and change the custom fields values.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
Duplicate post.
https://developer.salesforce.com/forums/ForumsMain?id=9062I000000IKo5QAG