• Gavin Jolley
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi Team,
I have inherited an org that has a good amount of custom delelopment done by a previous full time developer.

I would like to deploy a slight update to a trigger but when I deploy I get the error - TestMethod do not support Web service callouts when running the apex tests.

The test that fails is this one...

@isTest(seealldata=true) 
public class MilestoneUtilsTest
 {
     static testmethod void testMethod2(){
         Account acc1 = new Account();
            acc1.name = 'Test Account';
            insert acc1;
String milestoneName='Test';
DateTime complDate = DateTime.newInstance(2012, 7, 09, 3, 3, 3);
Case cs1 = new case();
          
            
           cs1.AccountId=acc1.id;
         cs1.Priority='High';
         cs1.Subject='Test';
            insert cs1;
            
            List<id> caseids=new List<id>();
        caseids.add(cs1.id);

    MilestoneUtils.completeMilestone(caseIds, milestoneName, complDate);
    
 List<CaseMilestone> caseMilestones = [select Id, completionDate from CaseMilestone cm where caseId in :caseIds];
    system.debug('**1**' + caseMilestones.size());
    for (CaseMileStone cm : caseMilestones) {
        cm.CompletionDate = System.today();
    }

    update caseMilestones;
         
         
     }
   
static testMethod void CloseCaseTest() {
// TO DO: implement unit test

Account acc = new account(name = 'TestCoverage');
insert acc;
Contact con = new contact(accountId = acc.id, lastname='Coverage', firstname='Test');
insert con;
Asset ass = new asset(name = 'TestAsset', accountId = acc.id);
insert ass;
Entitlement ent = new entitlement(name = 'TestEnt', accountId = acc.id);
insert ent;


Case cseA = new case(accountId = acc.id, contactId = con.id, subject = 'TestCoverage1', EntitlementId = ent.Id, Reason = 'Software Query', Type= 'Help Request', Description = 'Test Coverage'); 
insert cseA; 

List<CaseMilestone> CaseMls = [select Id, completionDate from CaseMilestone
where caseId = :cseA.Id ];

cseA.status = 'Closed';
try{
update cseA; 
}catch(Exception e){
if(CaseMls.isEmpty() == false){ 
for (CaseMilestone cm : CaseMls){
if(cm.completionDate == null)
{
// system.assertEquals(e.getMessage(), 'The completion Date of Case Milestone(s) must be filled to close the case');
}
}
}
}
}
}
 

Is anyone able to help me identify where the web call out is happening... (sorry I'm not a developer)

Thanks
Gavin

Hi Team,
I have inherited an org that has a good amount of custom delelopment done by a previous full time developer.

I would like to deploy a slight update to a trigger but when I deploy I get the error - TestMethod do not support Web service callouts when running the apex tests.

The test that fails is this one...

@isTest(seealldata=true) 
public class MilestoneUtilsTest
 {
     static testmethod void testMethod2(){
         Account acc1 = new Account();
            acc1.name = 'Test Account';
            insert acc1;
String milestoneName='Test';
DateTime complDate = DateTime.newInstance(2012, 7, 09, 3, 3, 3);
Case cs1 = new case();
          
            
           cs1.AccountId=acc1.id;
         cs1.Priority='High';
         cs1.Subject='Test';
            insert cs1;
            
            List<id> caseids=new List<id>();
        caseids.add(cs1.id);

    MilestoneUtils.completeMilestone(caseIds, milestoneName, complDate);
    
 List<CaseMilestone> caseMilestones = [select Id, completionDate from CaseMilestone cm where caseId in :caseIds];
    system.debug('**1**' + caseMilestones.size());
    for (CaseMileStone cm : caseMilestones) {
        cm.CompletionDate = System.today();
    }

    update caseMilestones;
         
         
     }
   
static testMethod void CloseCaseTest() {
// TO DO: implement unit test

Account acc = new account(name = 'TestCoverage');
insert acc;
Contact con = new contact(accountId = acc.id, lastname='Coverage', firstname='Test');
insert con;
Asset ass = new asset(name = 'TestAsset', accountId = acc.id);
insert ass;
Entitlement ent = new entitlement(name = 'TestEnt', accountId = acc.id);
insert ent;


Case cseA = new case(accountId = acc.id, contactId = con.id, subject = 'TestCoverage1', EntitlementId = ent.Id, Reason = 'Software Query', Type= 'Help Request', Description = 'Test Coverage'); 
insert cseA; 

List<CaseMilestone> CaseMls = [select Id, completionDate from CaseMilestone
where caseId = :cseA.Id ];

cseA.status = 'Closed';
try{
update cseA; 
}catch(Exception e){
if(CaseMls.isEmpty() == false){ 
for (CaseMilestone cm : CaseMls){
if(cm.completionDate == null)
{
// system.assertEquals(e.getMessage(), 'The completion Date of Case Milestone(s) must be filled to close the case');
}
}
}
}
}
}
 

Is anyone able to help me identify where the web call out is happening... (sorry I'm not a developer)

Thanks
Gavin