You need to sign in to do that
Don't have an account?
ManojKumar Muthu
Test class for HttpGet method
Hi there,
I am struggling to write a test class for below, can some help on this asap?
@RestResource(urlMapping='/CaseAccountid/*')
global with sharing class CaseAccountid{
@HttpGet
global static List<Case> getCaseById() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String Id = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
List<case> result = [Select id, IsEscalated, Case_Owner_Name__c, OwneEmail__c, subject, Case_Type__c, Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail, ContactId, OwnerId, CaseNumber, CSM_ID__c, CUP_Phone__c, Call_Type__c from Case where AccountId = :Id];
return result;
}
}
I am struggling to write a test class for below, can some help on this asap?
@RestResource(urlMapping='/CaseAccountid/*')
global with sharing class CaseAccountid{
@HttpGet
global static List<Case> getCaseById() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String Id = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
List<case> result = [Select id, IsEscalated, Case_Owner_Name__c, OwneEmail__c, subject, Case_Type__c, Code__c, Tracker__c, status, Version__c, type, priority, ContactEmail, ContactId, OwnerId, CaseNumber, CSM_ID__c, CUP_Phone__c, Call_Type__c from Case where AccountId = :Id];
return result;
}
}
All Answers
Thanks for taking effort to reply for my issue,
when i run the above your I am getting these error
Missing ';' at 'c.accountId'
Unexpected token ';'.
Variable does not exist: JsonMsg
Can me help me out?
Thank u sooo much