I want to create a callout exception in test class for covering batch apex callout.
I am able to cover the try block but can't get, how to cover the catch block.
Can i hardcode or put something like this CalloutException excpObj
with some particular exception so that the control enters the catch block??
for (Contact cont : scope){
try {
XXXXXXXX
} catch (CalloutException excpObj) {
some_method_name(cont.Id,' Callout Exception','---- ERROR = ' + excpObj.getMessage(),cont);
}
}