Created
September 17, 2013 19:15
-
-
Save noeticpenguin/6599287 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//In a class far far away... | |
@future | |
global static void RunMockCalloutForTest(String accountId){ | |
TestRestClient trc = new TestRestClient(); | |
id aId; | |
try { | |
aId = (Id) accountId; | |
} catch (Exception e) { | |
throw new exception('Failed to cast given accountId into an actual id, Send me a valid id or else.'); | |
} | |
Account a = [select id, name, stuff, foo, bar from Account where id = :aId]; | |
//make your callout | |
RestClientHTTPMocks fakeResponse = new RestClientHTTPMocks(200, 'Success', 'Success', new Map<String,String>()); | |
System.AssertNotEquals(fakeResponse, null); | |
Test.setMock(HttpCalloutMock.class, fakeResponse); | |
System.AssertNotEquals(trc, null); //this is a lame assertion. I'm sure you can come up with something useful! | |
String result = trc.get('http://www.google.com'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment