while calling method
@isTest
public class call_Test{
static testMethod void unitTest(){
uptodel.qTis();
}
}
its given error that Methods defined as TestMethod do not support Web service callouts
public class uptodel {
public static final String ts_url = 'https://example.com/study';
public static void qTis() {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(ts_url);
request.setMethod('GET');
HttpResponse response = http.send(request);
if (response.getStatusCode() == 200) {
Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
List<Object> contacts = (List<Object>) results.get('contacts');
for (Object contact: contacts) {
System.debug(contact);
}
}
}
}
List<Contact>
? You could query for the Contacts and check they're updated, using the mock callout/response as @RohitMourya suggested. If you are updating Contacts, you can assert that the Contact list is updated based on the response or not. – Dan Jones Mar 2 '17 at 13:21