So I have a method that takes as a parameter an Id of a object and uses it to make an external callout. Unfortunately I can't seem to figure out any way to test it.
@isTest static void sometimes_salesforces_sucks() {
My_Object__c foo = new My_Object__c(Name='test');
insert foo;
MyClient client = new MyClient();
MyMockResponseGenerator mockResponse = new MyMockResponseGenerator();
Test.setMock(HttpCalloutMock.class,mockResponse);
Test.startTest();
client.bar(foo.Id);
Test.stopTest();
}
This questionThis question says that using start/stop test should work, but it doesn't work for me