You need to sign in to do that
Don't have an account?
Timothy Smith
Error: Method must have a body
I have no idea why I am receiving this. Any assistance is appreciated.
@isTest private class ContactDNCTest { private static testMethod void testCloseOpps(){ //Create Account Account newAcc = FlowTestUtils.createHouseholdAccount(); insert newAcc; //Create Contacts List<Contact> conList = new List<Contact> { new Contact(FirstName='test1',LastName='tester',AccoutId = newAcc.Id, Email = 'test1@testing.com', Phone = 1234567891, Phone_Status__c = True, Work_Phone_Status__c = False, Mobile_Phone_Status__c = False), //Has Phone Number and Phone Status True new Contact(FirstName='test2',LastName='tester',AccoutId = newAcc.Id, Email = 'test2@tetsing.com', Phone_Status__c = False,Work_Phone_Status__c = False, Mobile_Phone_Status__c = False), // new Contact(FirstName='test3',LastName='tester',AccoutId = newAcc.Id, Email = 'test3@tetsing.com', Normalized_Work_Phone__c = 1234567891,Phone_Status__c = False, Work_Phone_Status__c = True, Mobile_Phone_Status__c = False), new Contact(FirstName='test4',LastName='tester',AccoutId = newAcc.Id, Email = 'test4@tetsing.com', Phone = 1234567891, Phone_Status__c = False, Work_Phone_Status__c = False, Mobile_Phone_Status__c = False), new Contact(FirstName='test5',LastName='tester',AccoutId = newAcc.Id, Email = 'test5@tetsing.com', Normalized_Mobile_Phone__c = 1234567891, Mobile_Phone_Status__c = True, Phone_Status__c = False,Work_Phone_Status__c = False), new Contact(FirstName='test6',LastName='tester',AccoutId = newAcc.Id, Email = 'test6@tetsing.com', Normalized_Work_Phone__c = 1234567891, Phone_Status__c = False, Work_Phone_Status__c = False,Mobile_Phone_Status__c = False) }; insert conList; //Create a List of Opportunities List<Opportunity> oppList = new List<Opportunity>{ new Opportunity(Name = 'Opp1', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today(), Primary_Contact__c = [SELECT Id FROM Contact WHERE FirstName = ['test1'], new Opportunity(Name = 'Opp2', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today(), Primary_Contact__c = [SELECT Id FROM Contact WHERE FirstName = ['test2'], new Opportunity(Name = 'Opp3', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today(), Primary_Contact__c = [SELECT Id FROM Contact WHERE FirstName = ['test3'], new Opportunity(Name = 'Opp4', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today(), Secondary_Contact__c = [SELECT Id FROM Contact WHERE FirstName = ['test4'], new Opportunity(Name = 'Opp5', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today(), Secondary_Contact__c = [SELECT Id FROM Contact WHERE FirstName = ['test5'], new Opportunity(Name = 'Opp7', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today(), Secondary_Contact__c = [SELECT Id FROM Contact WHERE FirstName = ['test6'], new Opportunity(Name = 'Opp8', AccountId = newACC.id, StageName = 'Ready to Call/Schedule', CloseDate = Date.today() }; insert oppList; } }
Hi Timothy Smith,
Your code is looking correct. So just refresh your console and save again
after that, if the problem is no solved then use the below code.
or
please let me know it is working or not.
Please mark it as the Best Answer if it helps you.
Thank You
I have faced this problam before. simply I had refreshed my developer console and then change anything(you need to Resave) and then my code had saved.
but by chance If your problam not solve then simply you follow following steps.
1.
only create your class like above and then save and if it save successfuly than put your entire code into this method.
I am sure it will work.
let me know if it helps you by marking it as best answer and if still you have any issue than mention here.
Thank You