You need to sign in to do that
Don't have an account?
Trinityed78
HELP! Apex Test class has disappeared and need to create a new one.
Hi all!
For some reason an apex test class is missing in my production environment, and I have no clue as to where it went or why it disappeared.
So instead of looking for it, and to save time, I am trying to create a new test class to satisfy it.
I know I created one a while back, but cannot remember how I formatted it (as I'm not an expert) or what was covered in the test.
Here's the apex class:
public class ext_contact_subscriptions { public Contact contact = new Contact(); public Boolean emailVerified { get; set; } public String enteredEmail { get; set; } public Boolean success { get; set; } public Boolean validationError { get; set; } public string msg { get; set; } public Subscription_Update__c subscription { get {return subscription;} set {subscription = value;} } public ext_contact_subscriptions() { emailVerified = false; validationError = false; success = false; } public PageReference validateEmail() { List<Contact> contacts = [select id, email, HasOptedOutOfEmail, Subscription_Update__c from contact where email = :enteredEmail]; if (contacts.size()==1) { contact = contacts[0]; //contact.email = 'john.smith@ibs.net'; if (enteredEmail == contact.email) { emailVerified = true; validationError = false; subscription = new Subscription_Update__c(); subscription.contact__c = contact.id; subscription.Email_Address__c = contact.email; } else { validationError = true; } } else { validationError = true; } return null; } public PageReference save() { try { //update contact; insert subscription; success = true; } catch (exception e) { msg = e.getMessage(); } return null; } }
Can anyone help me to create a test class, based on this code?
Ed.
Can anyone help please?
I've been racking my brain for a few hours trying to sort this out, and I keep clutching at straws trying to find an expert who can give me some valuable tips.
Hope an expert out there is able to help?